This repository was archived by the owner on Nov 21, 2025. It is now read-only.
Commit 888875f
authored
Syntax cleanup (#1953)
* refactor(extension): clean up embedded language configuration
The embeddedLanguages configuration of a grammer is meant to map scope name to the name of the language
for that scope.
* refactor(syntaxes): Only inject template scopes to html
Template scopes do not need to be injected directly to source.ts.
Instead, template scopes apply when inline templates have been matched
in TS files and are included as patterns under that match.
The Angular template syntaxes _could_ be directly injected into TS like
they are now. This would apply them to any embedded `text.html` in a TS file.
This change applies Angular template grammars only to embedded HTML
matched by the inline template grammar (strings under `template:` of a
decorator).
`injectTo` applies only to the top-level file language and not embedded
labguages. So our `injectTo` `text.html` will not automatically apply to
inline templates simply by setting the `contentName` and language.
It would also be nice to further limit our grammars to apply only to
files that we know are Angular templates rather than injecting to every
to-level `.html` file.
In the future we might want to explore _not_ injecting into all top-level
`html` and then using `injectionSelector` to control from there. This
approach makes it difficult for environments that support
many frameworks/languages (stackblitz/textmate#4).
We might be able to create an "angular" language for `.component.html` and `.ng.html` files and use
our grammars only for those extensions rather than injecting them into
any and all `html`.1 parent b742190 commit 888875f
File tree
4 files changed
+21
-26
lines changed- .aspect/rules/external_repository_action_cache
- syntaxes
- src
4 files changed
+21
-26
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
| 167 | + | |
175 | 168 | | |
176 | 169 | | |
177 | 170 | | |
178 | 171 | | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
| 172 | + | |
187 | 173 | | |
188 | 174 | | |
189 | 175 | | |
190 | 176 | | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
| 177 | + | |
195 | 178 | | |
196 | 179 | | |
197 | 180 | | |
198 | 181 | | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
| 182 | + | |
203 | 183 | | |
204 | 184 | | |
205 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
72 | 81 | | |
73 | 82 | | |
74 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
41 | 47 | | |
42 | 48 | | |
43 | 49 | | |
0 commit comments