CSS-aware syntax scoping for style bindings#67396
Draft
kbrilla wants to merge 5 commits intoangular:mainfrom
Draft
CSS-aware syntax scoping for style bindings#67396kbrilla wants to merge 5 commits intoangular:mainfrom
kbrilla wants to merge 5 commits intoangular:mainfrom
Conversation
josephperrott
approved these changes
Mar 2, 2026
Member
josephperrott
left a comment
There was a problem hiding this comment.
LGTM
Reviewed-for: dev-infra
c2de52e to
78c1a3f
Compare
Stabilizes e2e activation/waits, runner launch args/timeouts, and test constants for markdown fixture targeting.
Adds angular-ts/angular-html markdown fence grammars and injection wiring for inline template/styles and host bindings in fenced contexts.
Include the fenced inline-template scope fix and checklist cleanup in the e2e coverage update so branch history stays at three commits.
78c1a3f to
8998d0e
Compare
Member
|
Marking as draft as its coupled with a previous PR: #67357 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Style bindings in Angular templates and host metadata are tokenized as plain strings without CSS-aware scoping. This means:
style="color: red; font-size: 14px"— the value is a generic HTML attribute string[style]="'border: 1px solid black'"— CSS declarations inside the string literal are not recognized[style.width.px]="'320'"— CSS units likepx,em,%in binding keys are not scoped[style]="{ color: 'red' }"— object literal style values get no CSS scopingstyle:,'[style]','[style.prop.unit]'— same lack of CSS awarenessThis results in style values appearing as uniform string colors in the editor, losing the visual distinction between property names, values, units, custom properties, and separators that users get in
<style>blocks and.cssfiles.Depends on: #67357
What is the new behavior?
Style bindings now receive CSS-aware syntax scoping that matches the behavior of
<style>blocks and.cssfiles:Template bindings
style="color: red; font-size: 14px"— full CSS declaration scoping (property names, values, separators)[style]="'border: 1px solid black; --padding: 1em'"— CSS declarations inside string literals[style.prop.unit]="'value'"— CSS property-value scoping withkeyword.other.unit.cssfor units[style]="{ color: 'red', 'font-size': '14px' }"— object literal keys as CSS property names, values as CSS values--custom-prop) getvariable.cssscopingHost metadata
style: 'display: block; border: 1px solid black'— CSS declaration scoping'[style]': '"width: 200px; height: 50px"'— CSS declaration scoping'[style.padding.px]': '"8"'— CSS value scoping with unit awarenessMarkdown fences
angular-htmlandangular-tsfenced code blocksScope assignments
color,border)meta.property-name.css support.type.property-name.css--gap)meta.property-name.css variable.css:)punctuation.separator.key-value.css;)punctuation.terminator.rule.csssource.css#property-values(delegated to VS Code CSS grammar)px,em,%)keyword.other.unit.cssScreenshots
Does this PR introduce a breaking change?
Other information
fix/issue-66641-vscode-only(Dedicated markdown-fence grammar support forangular-tsandangular-html#67357) and adds CSS scoping on top of the markdown fence grammar support.pnpm bazel test //vscode-ng-language-service/syntaxes/test:test(pass)pnpm bazel test //vscode-ng-language-service/integration/e2e:test --test_output=errors --test_env=PATH=/opt/X11/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin --nocache_test_results(pass)<style>block,.cssfile,style=""attribute,[style]binding,[style.prop.unit]binding, and[style]object literal — asserting identical CSS scopes across all contextsstyle:, dynamic'[style]', and'[style.prop.unit]'bindingsangular-htmlandangular-tsmarkdown blocks[style]="dynamicStyle") correctly get NO CSS scopes!important, single-quotedstyle='...', multiline style attributes, Angular control flow after style bindingsembeddedLanguagesmappings added topackage.jsonforsource.cssinangular-html,angular-ts, and the inline template grammar — enabling VS Code CSS IntelliSense features (completions, hover, color pickers) inside style bindingstemplate-tagandhost-object-literalgrammars