Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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`.
- Loading branch information