Commit graph

8 commits

Author SHA1 Message Date
Benny Powers
f4f9a36fa4 fix(ecma): use scoped injections instead of combined
Use `[string_fragment template_substitution]+` pattern for scoped
injections per maintainer feedback, avoiding the cost of combined
injections. This requires splitting alternations into separate patterns
for the `fn()` and tagged template literal forms.

Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 10:08:44 +03:00
Benny Powers
605ba7428f fix(injections): use string_fragment for template literal injections
Template literal injection queries previously captured the entire
`template_string` node with `injection.include-children`, which caused
template substitutions (e.g. `${expr}`) to be included in the injected
language's parse input. This broke highlighting in cases like:

    html`<p class="static ${classMap({ dynamic })} after"></p>`

where the HTML parser's attribute_value node would span across the
template substitution gap, and the lit-html `${` injection query
(in html_tags) would match the buffer text at that range, injecting
JS at the wrong offset.

Two fixes:

1. ecma/injections.scm: capture `string_fragment` nodes instead of
   `template_string`, and use `injection.combined` to merge them. This
   aligns with upstream tree-sitter-javascript's approach. The `#offset!`
   directives are removed since `string_fragment` already excludes the
   backticks.

2. html_tags/injections.scm: anchor the lit-html `${` pattern with `^`
   so it only matches attribute values that *start* with `${`, not
   attribute values whose buffer text happens to contain `${` in the
   middle (which occurs when the attribute_value node spans a template
   substitution gap).

Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 22:04:12 +03:00
Ethan Rutt
995b75fd51
feat: add gql function highlighting for ecmascript injection (#8541) 2026-03-01 13:29:06 -08:00
Igor
ae2081cfcd feat(ecma): variable definition from object destructure with alias 2026-02-27 09:00:07 +01:00
Igor Lacerda
53049d6678
feat(ecma): variable definition from object destructure (#8233) 2025-11-04 20:03:42 -08:00
Riley Bruins
40cca05b40 fix(c, ecma): remove invalid predicate parameters
These are not valid named nodes in their respective languages.
2025-07-22 09:52:32 +02:00
Alan Russell
61ec748ef7
feat(groq): add parser and queries (#8008) 2025-07-18 18:04:42 +02:00
Christian Clason
692b051b09 feat!: drop modules, general refactor and cleanup 2025-05-12 18:43:40 +02:00