Packages icon indicating copy to clipboard operation
Packages copied to clipboard

[Common] Adjust meta.embedded vs. meta.interpolation

Open deathaxe opened this issue 1 year ago • 0 comments

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:

  1. 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 scoped meta.interpolation as this is not what interpolation is.

  2. 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 scoped meta.embedded as distinction is not possible in all template syntaxes and some of them even provide additional real string interpolation constructs.

  3. 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.

deathaxe avatar Oct 05 '24 09:10 deathaxe