Skip to content

fix(vscode-extension): allow Tailwind-style characters in property binding names - #70526

Merged
atscott merged 1 commit into
angular:mainfrom
aparzi:fix-vscode-tailwind-class-binding
Sep 25, 2026
Merged

atscott merged 1 commit into
angular:mainfrom
aparzi:fix-vscode-tailwind-class-binding

Conversation

@aparzi

@aparzi aparzi commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

The property binding grammar only allowed [-_a-zA-Z0-9.$] in binding names, so Tailwind class bindings such as [class.hover:flex], [class.!p-4] or [class.bg-primary/30] did not match and fell back to plain HTML attribute highlighting. The compiler is deliberately lenient about the characters between the square brackets of a bound attribute name, so allow :, !, / and @ in the grammar as well.

Fixes #67679

PR Checklist

Please check if your PR fulfills the following requirements:

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:

Issue Number: #67679

Does this PR introduce a breaking change?

  • Yes
  • No

@pullapprove
pullapprove Bot requested a review from atscott September 2, 2026 12:46
@angular-robot angular-robot Bot added the area: vscode-extension Issues related to the Angular Language Service VsCode extension label Sep 2, 2026
@ngbot ngbot Bot added this to the Backlog milestone Sep 2, 2026
Comment thread vscode-ng-language-service/syntaxes/src/template-tag.ts Outdated
Comment thread vscode-ng-language-service/syntaxes/src/template-tag.ts Outdated

@JeanMeche JeanMeche left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beside the security concern, lgtm

…nding names

The property binding grammar only allowed [-_a-zA-Z0-9.$] in binding
names, so Tailwind class bindings such as `[class.hover:flex]`,
`[class.!p-4]` or `[class.bg-primary/30]` did not match and fell back
to plain HTML attribute highlighting. The compiler is deliberately
lenient about the characters between the square brackets of a bound
attribute name, so allow `:`, `!`, `/` and `@` in the grammar as well.

Also removes the nested quantifier from the binding name regexes
((?:A+|B)* -> (?:A|B)*), which could trigger super-linear backtracking
on lines with an unterminated binding. The recognized language is
unchanged: the snapshot goldens are identical.

Fixes angular#67679
@aparzi
aparzi force-pushed the fix-vscode-tailwind-class-binding branch from 65ca272 to 7391e91 Compare September 15, 2026 08:00
@aparzi
aparzi requested a review from JeanMeche September 15, 2026 08:02
@JeanMeche
JeanMeche removed the request for review from atscott September 24, 2026 09:18
@JeanMeche JeanMeche added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Sep 24, 2026
@atscott
atscott merged commit 6f7f665 into angular:main Sep 25, 2026
25 checks passed
@atscott

atscott commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

This PR was merged into the repository. The changes were merged into the following branches:

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

Labels

action: merge The PR is ready for merge by the caretaker area: vscode-extension Issues related to the Angular Language Service VsCode extension target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

syntax highlighting issue with class binding and tailwind classes

3 participants