diff options
author | Dmitry Sharshakov | 2021-09-25 20:14:59 +0000 |
---|---|---|
committer | Dmitry Sharshakov | 2021-09-25 20:14:59 +0000 |
commit | bf53aff27d2d90b41bab01f4d628f0bd9fbcd589 (patch) | |
tree | 568d745540acd05ae7526e8a3eed7ee8e31e3cea /runtime/queries/svelte | |
parent | 413e477dc2d4792596f99979140d2879ec3d4f4f (diff) | |
parent | df55eaae69d0388de26448e82f9ded483fca2f44 (diff) |
Merge branch 'master' into debug
Diffstat (limited to 'runtime/queries/svelte')
-rw-r--r-- | runtime/queries/svelte/highlights.scm | 68 | ||||
-rw-r--r-- | runtime/queries/svelte/indents.toml | 18 | ||||
-rw-r--r-- | runtime/queries/svelte/injections.scm | 30 |
3 files changed, 116 insertions, 0 deletions
diff --git a/runtime/queries/svelte/highlights.scm b/runtime/queries/svelte/highlights.scm new file mode 100644 index 00000000..4c6f5f35 --- /dev/null +++ b/runtime/queries/svelte/highlights.scm @@ -0,0 +1,68 @@ +; Special identifiers +;-------------------- + +; TODO: +((element (start_tag (tag_name) @_tag) (text) @markup.heading) + (#match? @_tag "^(h[0-9]|title)$")) + +((element (start_tag (tag_name) @_tag) (text) @markup.bold) + (#match? @_tag "^(strong|b)$")) + +((element (start_tag (tag_name) @_tag) (text) @markup.italic) + (#match? @_tag "^(em|i)$")) + +; ((element (start_tag (tag_name) @_tag) (text) @markup.strike) +; (#match? @_tag "^(s|del)$")) + +((element (start_tag (tag_name) @_tag) (text) @markup.underline) + (#eq? @_tag "u")) + +((element (start_tag (tag_name) @_tag) (text) @markup.inline) + (#match? @_tag "^(code|kbd)$")) + +((element (start_tag (tag_name) @_tag) (text) @markup.underline.link) + (#eq? @_tag "a")) + +((attribute + (attribute_name) @_attr + (quoted_attribute_value (attribute_value) @markup.undeline.link)) + (#match? @_attr "^(href|src)$")) + +(tag_name) @tag +(attribute_name) @property +(erroneous_end_tag_name) @error +(comment) @comment + +[ + (attribute_value) + (quoted_attribute_value) +] @string + +[ + (text) + (raw_text_expr) +] @none + +[ + (special_block_keyword) + (then) + (as) +] @keyword + +[ + "{" + "}" +] @punctuation.brackets + +"=" @operator + +[ + "<" + ">" + "</" + "/>" + "#" + ":" + "/" + "@" +] @punctuation.definition.tag diff --git a/runtime/queries/svelte/indents.toml b/runtime/queries/svelte/indents.toml new file mode 100644 index 00000000..693db8e3 --- /dev/null +++ b/runtime/queries/svelte/indents.toml @@ -0,0 +1,18 @@ +indent = [ + "element" + "if_statement" + "each_statement" + "await_statement" +] + +outdent = [ + "end_tag" + "else_statement" + "if_end_expr" + "each_end_expr" + "await_end_expr" + ">" + "/>" +] + +ignore = "comment" diff --git a/runtime/queries/svelte/injections.scm b/runtime/queries/svelte/injections.scm new file mode 100644 index 00000000..266f4701 --- /dev/null +++ b/runtime/queries/svelte/injections.scm @@ -0,0 +1,30 @@ +; injections.scm +; -------------- +((style_element + (raw_text) @injection.content) + (#set! injection.language "css")) + +((attribute + (attribute_name) @_attr + (quoted_attribute_value (attribute_value) @css)) + (#eq? @_attr "style")) + +((script_element + (raw_text) @injection.content) + (#set! injection.language "javascript")) + +((raw_text_expr) @injection.content + (#set! injection.language "javascript")) + +( + (script_element + (start_tag + (attribute + (quoted_attribute_value (attribute_value) @_lang))) + (raw_text) @injection.content) + (#match? @_lang "(ts|typescript)") + (#set! injection.language "typescript") +) + +(comment) @comment + |