[Common] Adjust meta.embedded vs. meta.interpolation #4054
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
inspired by #3051
This commit aligns meta.embedded and meta.interpolation scopes across HTML and its template languages.
The rule of thumb being applied is:
declarative syntaxes (CSS, JSON) or those executed at runtime (JS) are not scoped meta.embedded nor meta.interpolation. They are treated as belonging to HTML
It's wrong value of
<div style="...">
being scopedmeta.interpolation
as this is not what interpolation is.tags interpreted or executed by a pre-processor or template engine are scoped meta.embedded regardless they appear in normal text or strings.
A template engine's interpreter does not know anything about HTML or any other top-level syntax. It just interprets
embedded
special tokens.Some engines such as php distinguish statements
<?...?>
and expressions<?= ...?>
with the latter ones often used to expand to strings (acting like interpolation). Both are still scopedmeta.embedded
as distinction is not possible in all template syntaxes and some of them even provide additional real string interpolation constructs.only real string interpolations are scoped meta.interpolation, which most likely are part of an embedded templating language itself.
ERB provides
#{var}
interpolation to be used everywhere, for instance.