GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(vscode-extension): highlight ICU expressions in templates by aparzi · Pull Request #72239 · angular/angular

Conversation

@aparzi

@aparzi aparzi commented Nov 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Adds a TextMate grammar for ICU expressions (plural and select) so that their braces are no longer mistaken for interpolations.

Previously, a case body that starts with an interpolation, such as one {{{count}} item}, was highlighted incorrectly: the interpolation grammar matched the first two braces of {{{, which left the third one unbalanced inside of the expression and broke bracket matching.

The case value is matched together with the opening brace of the case, which allows the case to start before the interpolation injection gets a chance to match.

Fixes #62697

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines: https://github.com/angular/angular/blob/main/contributing-docs/commit-message-guidelines.md
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

ICU expressions have no grammar of their own, so their braces are only ever seen by the interpolation grammar. When a case body starts with an interpolation, the interpolation matches the first two braces of {{{ and the third one ends up unbalanced inside of the expression:

{count, plural,
  one {{{count}} Stored Bundle}
  other {{{count}} Stored Bundles}
}

This is the ICU counterpart of the block issue fixed in #64392, which noted that ICUs had no named scopes to exclude.

Issue Number: #62697

What is the new behavior?

A new template.icu.ng grammar recognizes plural and select ICU expressions, including nested ones, and highlights the switch expression, the ICU type and the case values.

The case value is matched together with the opening brace of the case. This makes the case start before the interpolation injection gets a chance to match, so the braces of one {{{count}} item} are now tokenized as the case brace followed by an interpolation.

I did not reuse the approach from #64392 (excluding the interpolation injection from the new scope) because the exclusion applies to the whole scope stack: it would also disable interpolation highlighting in attributes of elements inside a case body, e.g. other {<b title="{{ t }}">items</b>}.

Does this PR introduce a breaking change?

  • Yes
  • No

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@aparzi
fix(vscode-extension): highlight ICU expressions in templates
16e340e
Adds a TextMate grammar for ICU expressions (`plural` and `select`) so that
their braces are no longer mistaken for interpolations.

Previously, a case body that starts with an interpolation, such as
`one {{{count}} item}`, was highlighted incorrectly: the interpolation
grammar matched the first two braces of `{{{`, which left the third one
unbalanced inside of the expression and broke bracket matching.

The case value is matched together with the opening brace of the case, which
allows the case to start before the interpolation injection gets a chance to
match.

Fixes angular#62697
@pullapprove
pullapprove Bot requested a review from atscott November 27, 2026 16:57
@angular-robot angular-robot Bot added the area: vscode-extension Issues related to the Angular Language Service VsCode extension label Nov 27, 2026
@ngbot ngbot Bot added this to the Backlog milestone Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@atscott atscott Awaiting requested review from atscott

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

area: vscode-extension Issues related to the Angular Language Service VsCode extension

Projects

None yet

Milestone

Backlog

Development

Successfully merging this pull request may close these issues.

Syntax highlighting for ICU messages in templates highlights non-errors as error

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@aparzi
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.