Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular's interpolation wrapped into parentheses breaks control flow formatting #2351

Open
serhiisol opened this issue Feb 10, 2025 · 1 comment

Comments

@serhiisol
Copy link

serhiisol commented Feb 10, 2025

Description

Angular's interpolation wrapped into parentheses breaks control flow formatting.
If blank space is inserted between parentheses and interpolation (( {{ tag }} )) issue won't appear.

Input

@if (item.parent) {
  <a [routerLink]="['/items', item.parent.id]">
    {{ item.parent.name }} ({{ item.parent.tag }})
  </a>
} @else {
  <ng-container i18n>No parent assigned</ng-container>
}

Expected Output

@if (item.parent) {
  <a [routerLink]="['/animals', item.parent.id]">
    {{ item.parent.name }} ({{ item.parent.tag }})
  </a>
} @else {
  <ng-container i18n>Parent is not assigned</ng-container>
}

Actual Output

@if (item.parent) {
  <a [routerLink]="['/items', item.parent.id]">
    {{ item.parent.name }} ({{ item.parent.tag }})
  </a>
  } @else {
    <ng-container i18n>No parent assigned</ng-container>
  }

Steps to Reproduce

Environment

OS: macOS 15.3 (24D60)

Settings

VSCode settings:

{
  "[html]": {
    "editor.defaultFormatter": "vscode.html-language-features"
  },
  "html.completion.attributeDefaultValue": "doublequotes",
  "html.format.indentHandlebars": true,
  "html.format.wrapAttributes": "force-expand-multiline",
  // Ignore warning, vscode doesn't allow anything but boolean, but actual extension supports it
  "html.format.templating": [
    "angular"
  ],
}
@jbouchard24
Copy link

I have this issue too, but it seems to happen when any character other than space preceeds an interpolation.

Examples that cause the issue

({{ amount }} some text)
{{ numerator }}/{{ denominator }}
{{ firstName }}&nbsp;{{ lastName }}

Examples that do not cause the issue

(some text {{ amount }})
{{ numerator }} / {{ denominator }}
{{ firstName }} {{ lastName }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants