Skip to content

Commit d291a15

Browse files
committed
Properly inject Angular template grammar in inline templates
It seems that to get inline templates to be syntax highlighted with the angular template grammar correctly, we not only need to include the `template.ng` grammar pattern when matching an inline template (which previously worked only for interpolations but would not seem to correctly recognize template bindings); we also need to tell VSCode that it should inject the template grammar in TypeScript files. I cannot find a way to test this (since it differs from the TextMate grammar tests, as this change instructs VSCode specifically how to add the grammars), but screenshots attached to the PR for this commit demonstrate before- and after-this-change syntax highlight on an inline template. Furthermore non-template TypeScript should not be matched by the template grammar, since the template grammar can only be injected when the base grammar is matched to be HTML (which only happens when we match an inline template). I couldn't figure this out a couple months back, but looked back today and got it almost immediately :) I guess some time away is a good thing. Closes #768
1 parent e9a14b6 commit d291a15

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@
8181
"path": "./syntaxes/template.json",
8282
"scopeName": "template.ng",
8383
"injectTo": [
84-
"text.html.derivative"
84+
"text.html.derivative",
85+
"source.ts"
8586
],
8687
"embeddedLanguages": {
8788
"text.html": "html",

0 commit comments

Comments
 (0)