Skip to content

Commit a18c617

Browse files
authored
fix(syntaxes): add back block syntaxes to injection for entire TS file (#2063)
We rely on the `injectionSelector` to prevent matching our grammars in contexts which they should not apply. The `injectionSelector` only applies when the grammar is injected to the file via `injectTo`. Otherwise, the grammer is applied directly when it is included in the `patterns` array of another match. fixes #2062
1 parent f4a258c commit a18c617

File tree

4 files changed

+6
-18
lines changed

4 files changed

+6
-18
lines changed

.aspect/rules/external_repository_action_cache/npm_translate_lock_LTE4Nzc1MDcwNjU=

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
.npmrc=974837034
55
pnpm-lock.yaml=1988059937
66
yarn.lock=448809282
7-
package.json=-1372627236
7+
package.json=172429918
88
pnpm-workspace.yaml=1711114604

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -164,17 +164,17 @@
164164
{
165165
"path": "./syntaxes/template.json",
166166
"scopeName": "template.ng",
167-
"injectTo": ["text.html.derivative"]
167+
"injectTo": ["text.html.derivative", "source.ts"]
168168
},
169169
{
170170
"path": "./syntaxes/template-blocks.json",
171171
"scopeName": "template.blocks.ng",
172-
"injectTo": ["text.html.derivative"]
172+
"injectTo": ["text.html.derivative", "source.ts"]
173173
},
174174
{
175175
"path": "./syntaxes/let-declaration.json",
176176
"scopeName": "template.let.ng",
177-
"injectTo": ["text.html.derivative"]
177+
"injectTo": ["text.html.derivative", "source.ts"]
178178
},
179179
{
180180
"path": "./syntaxes/template-tag.json",

syntaxes/inline-template.json

-6
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,6 @@
6969
},
7070
{
7171
"include": "template.ng"
72-
},
73-
{
74-
"include": "template.blocks.ng"
75-
},
76-
{
77-
"include": "template.let.ng"
7872
}
7973
]
8074
}

syntaxes/src/inline-template.ts

+2-8
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,8 @@ export const InlineTemplate: GrammarDefinition = {
3939
endCaptures: {0: {name: 'string'}},
4040
contentName: 'text.html.derivative',
4141
patterns: [
42-
{include: 'text.html.derivative'}, {include: 'template.ng'},
43-
{include: 'template.blocks.ng'}, {include: 'template.let.ng'},
44-
// note: template.tag.ng isn't used here and needs to be directly injected into source.ts
45-
// scopes at the top level because it relies entirely on the injectionSelector to filter its
46-
// matching out of non-html tag contexts. Since we don't have any scopes that match HTML
47-
// tags, we rely entirely on the text.html.derivative pattern matching and apply the tag
48-
// scope via injectionSelector only rather than being able to include it in a pattern list
49-
// of another match.
42+
{include: 'text.html.derivative'},
43+
{include: 'template.ng'},
5044
]
5145
}
5246
}

0 commit comments

Comments
 (0)