angular/vscode-ng-language-service/syntaxes
Andrew Scott 80e00ff4e5 fix(language-service): prevent interpolation from superseding block braces (#64392)
This change omits the injection of the template syntaxes inside any
existing block scope. The injection is not needed because the template
and expression scopes are included explicitly as patterns where
appropriate under the template-blocks definitions.

This change prevents the interpolation curly braces from superseding the
match for the open curly of the block body. This issue also happens with
ICUs (#62697), but those do not have any named scopes to exclude as of
today.

fixes https://github.com/angular/vscode-ng-language-service/issues/1991

PR Close #64392
2025-10-20 17:49:04 +00:00
..
src fix(language-service): prevent interpolation from superseding block braces (#64392) 2025-10-20 17:49:04 +00:00
test build: migrate to in-repo ts_project with strict deps (#64306) 2025-10-09 10:00:31 -07:00
BUILD.bazel build: migrate to in-repo ts_project with strict deps (#64306) 2025-10-09 10:00:31 -07:00
expression.json build: migrate vscode extension into repo (#63924) 2025-09-24 20:24:32 +00:00
host-object-literal.json build: migrate vscode extension into repo (#63924) 2025-09-24 20:24:32 +00:00
inline-styles.json build: migrate vscode extension into repo (#63924) 2025-09-24 20:24:32 +00:00
inline-template.json build: migrate vscode extension into repo (#63924) 2025-09-24 20:24:32 +00:00
let-declaration.json build: migrate vscode extension into repo (#63924) 2025-09-24 20:24:32 +00:00
README.md build: migrate vscode extension into repo (#63924) 2025-09-24 20:24:32 +00:00
template-blocks.json build: migrate vscode extension into repo (#63924) 2025-09-24 20:24:32 +00:00
template-tag.json build: migrate vscode extension into repo (#63924) 2025-09-24 20:24:32 +00:00
template.json fix(language-service): prevent interpolation from superseding block braces (#64392) 2025-10-20 17:49:04 +00:00
tsconfig.json build: migrate vscode extension into repo (#63924) 2025-09-24 20:24:32 +00:00

Read This!

The JSON files in this directory are not meant to be edited by hand.

If you need to make modification, the respective files should be changed within the repository's syntaxes/src directory.

Running pnpm build:syntaxes will then appropriately update the files in this directory.

Syntaxes

This directory specifies TextMate grammars used by VSCode to syntax highlight Angular source code.

Adding a new grammar

To add a new grammar (not modifying an existing one), write the grammar as a JSON file in this directory and register it in the root directory's package.json under the contributes.grammars array.

Testing grammars

This repository uses vscode-tmgrammar-test for testing VSCode TextMate grammars.

Snapshot Tests

Snapshot test cases are specified in test/cases.json.

  • The source file to test the grammar on should go in test/data/.
  • If an external grammar is needed (e.g. for HTML) is needed, a dummy grammar can be specified in test/dummy/ and will be automatically picked up by the grammar test driver.
  • Each snapshot tests requires a language scope to test. Generally, this is the scope name of the grammar being tested (e.g. inline-template.ng for the inline template grammar). This scope will become the base name of the grammar matched for everything in the source file being tested, upon which more specific grammar matches will be stacked.

Snapshot golden files can be updated by running

pnpm test:legacy-syntaxes -u

in the root directory of this repository. Goldens must be updated when a new test case is added. Be sure to check that the updated golden file looks as you expect.