From 2eb737dc68f278ffe62a943da7d40b291cd4929c Mon Sep 17 00:00:00 2001 From: themixednuts <118081862+themixednuts@users.noreply.github.com> Date: Tue, 24 Mar 2026 16:05:52 -0500 Subject: [PATCH] fix(svelte): format queries --- runtime/queries/svelte/highlights.scm | 74 ++++++++++++++++++++------- runtime/queries/svelte/injections.scm | 38 ++++++++------ 2 files changed, 79 insertions(+), 33 deletions(-) diff --git a/runtime/queries/svelte/highlights.scm b/runtime/queries/svelte/highlights.scm index a43e01ed7..367b51eb3 100644 --- a/runtime/queries/svelte/highlights.scm +++ b/runtime/queries/svelte/highlights.scm @@ -16,15 +16,23 @@ property: (tag_member) @tag) (attribute_directive) @keyword -(attribute_name ":" @punctuation.delimiter) + +(attribute_name + ":" @punctuation.delimiter) + (attribute_identifier) @property + (attribute_modifier) @attribute -(attribute_modifiers "|" @punctuation.delimiter) + +(attribute_modifiers + "|" @punctuation.delimiter) (expression) @embedded + (expression_value) @embedded -(shorthand_attribute content: (_) @variable) +(shorthand_attribute + content: (_) @variable) [ "{" @@ -33,8 +41,11 @@ "|" @punctuation.delimiter -(tag_comment kind: (line_comment) @comment) -(tag_comment kind: (block_comment) @comment) +(tag_comment + kind: (line_comment) @comment) + +(tag_comment + kind: (block_comment) @comment) [ "if" @@ -52,29 +63,56 @@ ] @keyword.control (block_keyword) @keyword.control + (block_open) @tag.delimiter + (block_close) @tag.delimiter + (shorthand_kind) @keyword.control + (branch_kind) @keyword.control + (block_sigil) @keyword.control -(if_block expression: (expression) @embedded) -(else_if_clause expression: (expression_value) @embedded) +(if_block + expression: (expression) @embedded) -(each_block expression: (expression) @embedded) -(each_block binding: (pattern) @variable) -(each_block index: (pattern) @variable) -(each_block key: (expression) @embedded) +(else_if_clause + expression: (expression_value) @embedded) -(await_block expression: (expression) @embedded) -(await_branch (pattern) @variable) -(await_block (pattern) @variable) -(orphan_branch (pattern) @variable) +(each_block + expression: (expression) @embedded) -(key_block expression: (expression) @embedded) +(each_block + binding: (pattern) @variable) + +(each_block + index: (pattern) @variable) + +(each_block + key: (expression) @embedded) + +(await_block + expression: (expression) @embedded) + +(await_branch + (pattern) @variable) + +(await_block + (pattern) @variable) + +(orphan_branch + (pattern) @variable) + +(key_block + expression: (expression) @embedded) + +(snippet_block + name: (snippet_name) @function) + +(snippet_parameters + parameter: (pattern) @variable) -(snippet_block name: (snippet_name) @function) -(snippet_parameters parameter: (pattern) @variable) (snippet_type_parameters) @type [ diff --git a/runtime/queries/svelte/injections.scm b/runtime/queries/svelte/injections.scm index a223609a4..4eab50695 100644 --- a/runtime/queries/svelte/injections.scm +++ b/runtime/queries/svelte/injections.scm @@ -25,12 +25,7 @@ (#eq? @_tag "script") (#eq? @_lang "lang") (#not-any-of? @injection.language - "ts" - "typescript" - "text/typescript" - "js" - "javascript" - "text/javascript")) + "ts" "typescript" "text/typescript" "js" "javascript" "text/javascript")) ((element (start_tag @@ -92,7 +87,8 @@ ((attribute (attribute_name) @_style_name - (quoted_attribute_value (attribute_value) @injection.content)) + (quoted_attribute_value + (attribute_value) @injection.content)) (#eq? @_style_name "style") (#set! injection.language "css")) @@ -117,24 +113,36 @@ (attribute_value) @injection.content) (#set! injection.language "javascript")) -((expression content: (js) @injection.content) +((expression + content: (js) @injection.content) (#set! injection.language "javascript")) -((expression content: (ts) @injection.content) + +((expression + content: (ts) @injection.content) (#set! injection.language "typescript")) -((shorthand_attribute content: (js) @injection.content) +((shorthand_attribute + content: (js) @injection.content) (#set! injection.language "javascript")) -((shorthand_attribute content: (ts) @injection.content) + +((shorthand_attribute + content: (ts) @injection.content) (#set! injection.language "typescript")) -((expression_value content: (js) @injection.content) +((expression_value + content: (js) @injection.content) (#set! injection.language "javascript")) -((expression_value content: (ts) @injection.content) + +((expression_value + content: (ts) @injection.content) (#set! injection.language "typescript")) -((pattern content: (js) @injection.content) +((pattern + content: (js) @injection.content) (#set! injection.language "javascript")) -((pattern content: (ts) @injection.content) + +((pattern + content: (ts) @injection.content) (#set! injection.language "typescript")) ((snippet_type_parameters) @injection.content