Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax cleanup #1953

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Syntax cleanup #1953

wants to merge 2 commits into from

Conversation

atscott
Copy link
Collaborator

@atscott atscott commented Nov 3, 2023

Cleans up some syntax configurations. See individual commits.

The embeddedLanguages configuration of a grammer is meant to map scope name to the name of the language
for that scope.
fvsch added a commit to stackblitz/textmate that referenced this pull request Nov 6, 2023
@atscott atscott force-pushed the syntaxCleanup branch 2 times, most recently from 4cad045 to ff5b3d0 Compare November 6, 2023 14:26
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`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant