From ff7ec08a1e90a38c955a17c51afb3046ee98e608 Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Mon, 8 Feb 2021 18:48:14 +0100 Subject: [PATCH] Add support for Vue files I haven't included parsing the `style` tag, since the only applicable queries we have are CSS (which actually works fine for SCSS too). --- queries/vue/highlights.scm | 38 ++++++++++++++++++++++++++++++++++++++ queries/vue/injections.scm | 19 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 queries/vue/highlights.scm create mode 100644 queries/vue/injections.scm diff --git a/queries/vue/highlights.scm b/queries/vue/highlights.scm new file mode 100644 index 000000000..f16c189a1 --- /dev/null +++ b/queries/vue/highlights.scm @@ -0,0 +1,38 @@ +[ + (component) + (template_element) + (start_tag) + (tag_name) + (directive_attribute) + (directive_dynamic_argument) + (directive_dynamic_argument_value) + (component) + (end_tag) +] @tag + +(erroneous_end_tag_name) @error +(attribute_name) @property +(attribute_value) @string +(quoted_attribute_value) @string +(comment) @comment + +(text) @none +(element) @string +(interpolation) @punctuation.special +(interpolation + (raw_text) @none) + +[ + (directive_modifier) + (directive_name) + (directive_argument) +] @method + +"=" @operator + +[ + "<" + ">" + "" + ] @tag.delimiter diff --git a/queries/vue/injections.scm b/queries/vue/injections.scm new file mode 100644 index 000000000..602f4f4f2 --- /dev/null +++ b/queries/vue/injections.scm @@ -0,0 +1,19 @@ +((style_element + (raw_text) @css)) + +; There's no queries for less, sass nor postcss. + +((script_element + (raw_text) @javascript)) + +( + (script_element + (start_tag + (attribute + (quoted_attribute_value (attribute_value) @_lang))) + (raw_text) @typescript) + (#match? @_lang "(ts|typescript)") +) + +((interpolation + (raw_text) @javascript))