Switch to tree-sitter-htmlx-svelte grammar#72
Open
themixednuts wants to merge 2 commits intozed-extensions:mainfrom
Open
Switch to tree-sitter-htmlx-svelte grammar#72themixednuts wants to merge 2 commits intozed-extensions:mainfrom
themixednuts wants to merge 2 commits intozed-extensions:mainfrom
Conversation
|
We require contributors to sign our Contributor License Agreement, and we don't have @themixednuts on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
Author
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
- Add explicit SCSS, SASS, and LESS injection rules before CSS fallback - Prevent CSS fallback from overriding preprocessor injections when lang attribute is present - Add inline style attribute CSS injection - Remove attribute_name captures from injection queries to preserve highlight colors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Replaces the tree-sitter grammar with tree-sitter-htmlx-svelte, which provides language injection into all template expressions.
The previous grammar parsed template expressions (
{foo},{@const x = 1},{@render children()},{#each items as item}, etc.) as opaque raw text with no language injection — meaning no syntax highlighting inside curly braces in the markup. This grammar injects JavaScript or TypeScript (based on<script lang="ts">) into every expression context, so template code gets full highlighting.What's new
{expressions}, block conditions, each bindings/keys, await patterns, and shorthand attributes get JS/TS syntax highlighting@attachsupport — the new Svelte 5 directive is fully parsed and highlighted{#snippet foo(bar, baz)}parameters are injected as JS/TS, not raw text{#snippet foo<T>(bar: T)}generics are injected as TypeScript{...rest}content is handled via JS injection, so...gets proper operator highlightingstyle="..."attribute values are injected as CSS for property highlighting//line comments and/* */block comments inside element tags are parsed and highlightedUpdated queries
highlights.scmandinjections.scmrewritten for the new node structureif,each,await,key,snippet,render,attach,const,html,debug) captured as@keyword.controlCloses #71
Closes #36
Old:

New:
