diff options
| author | Christian Clason <c.clason@uni-graz.at> | 2023-06-12 09:54:30 -0600 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2025-05-12 18:43:40 +0200 |
| commit | 692b051b09935653befdb8f7ba8afdb640adf17b (patch) | |
| tree | 167162b6b129ae04f68c5735078521a72917c742 /runtime/queries/cue | |
| parent | feat(c-family): inherit injections (diff) | |
| download | nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2 nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip | |
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'runtime/queries/cue')
| -rw-r--r-- | runtime/queries/cue/folds.scm | 5 | ||||
| -rw-r--r-- | runtime/queries/cue/highlights.scm | 164 | ||||
| -rw-r--r-- | runtime/queries/cue/indents.scm | 30 | ||||
| -rw-r--r-- | runtime/queries/cue/injections.scm | 2 | ||||
| -rw-r--r-- | runtime/queries/cue/locals.scm | 31 |
5 files changed, 232 insertions, 0 deletions
diff --git a/runtime/queries/cue/folds.scm b/runtime/queries/cue/folds.scm new file mode 100644 index 000000000..934b59e6f --- /dev/null +++ b/runtime/queries/cue/folds.scm @@ -0,0 +1,5 @@ +[ + (import_spec_list) + (field) + (string) +] @fold diff --git a/runtime/queries/cue/highlights.scm b/runtime/queries/cue/highlights.scm new file mode 100644 index 000000000..27d4daddc --- /dev/null +++ b/runtime/queries/cue/highlights.scm @@ -0,0 +1,164 @@ +; Includes +[ + "package" + "import" +] @keyword.import + +; Namespaces +(package_identifier) @module + +(import_spec + [ + "." + "_" + ] @punctuation.special) + +[ + (attr_path) + (package_path) +] @string.special.url ; In attributes + +; Attributes +(attribute) @attribute + +; Conditionals +"if" @keyword.conditional + +; Repeats +"for" @keyword.repeat + +(for_clause + "_" @punctuation.special) + +; Keywords +"let" @keyword + +"in" @keyword.operator + +; Operators +[ + "+" + "-" + "*" + "/" + "|" + "&" + "||" + "&&" + "==" + "!=" + "<" + "<=" + ">" + ">=" + "=~" + "!~" + "!" + "=" +] @operator + +; Fields & Properties +(field + (label + (identifier) @variable.member)) + +(selector_expression + (_) + (identifier) @property) + +; Functions +(call_expression + function: (identifier) @function.call) + +(call_expression + function: (selector_expression + (_) + (identifier) @function.call)) + +(call_expression + function: (builtin_function) @function.call) + +(builtin_function) @function.builtin + +; Variables +(identifier) @variable + +; Types +(primitive_type) @type.builtin + +((identifier) @type + (#lua-match? @type "^_?#")) + +[ + (slice_type) + (pointer_type) +] @type ; In attributes + +; Punctuation +[ + "," + ":" +] @punctuation.delimiter + +[ + "{" + "}" +] @punctuation.bracket + +[ + "[" + "]" +] @punctuation.bracket + +[ + "(" + ")" +] @punctuation.bracket + +[ + "<" + ">" +] @punctuation.bracket + +[ + (ellipsis) + "?" +] @punctuation.special + +; Literals +(string) @string + +[ + (escape_char) + (escape_unicode) +] @string.escape + +(number) @number + +(float) @number.float + +(si_unit + (float) + (_) @string.special.symbol) + +(boolean) @boolean + +[ + (null) + (top) + (bottom) +] @constant.builtin + +; Interpolations +(interpolation + "\\(" @punctuation.special + (_) + ")" @punctuation.special) @none + +(interpolation + "\\(" + (identifier) @variable + ")") + +; Comments +(comment) @comment @spell diff --git a/runtime/queries/cue/indents.scm b/runtime/queries/cue/indents.scm new file mode 100644 index 000000000..cef2345cc --- /dev/null +++ b/runtime/queries/cue/indents.scm @@ -0,0 +1,30 @@ +[ + (import_spec_list) + (field) +] @indent.begin + +[ + "}" + "]" + ")" +] @indent.end + +[ + "{" + "}" +] @indent.branch + +[ + "[" + "]" +] @indent.branch + +[ + "(" + ")" +] @indent.branch + +[ + (ERROR) + (comment) +] @indent.auto diff --git a/runtime/queries/cue/injections.scm b/runtime/queries/cue/injections.scm new file mode 100644 index 000000000..2f0e58eb6 --- /dev/null +++ b/runtime/queries/cue/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/cue/locals.scm b/runtime/queries/cue/locals.scm new file mode 100644 index 000000000..b2a8972f7 --- /dev/null +++ b/runtime/queries/cue/locals.scm @@ -0,0 +1,31 @@ +; Scopes +[ + (source_file) + (field) + (for_clause) +] @local.scope + +; References +(identifier) @local.reference + +; Definitions +(import_spec + path: (string) @local.definition.import) + +(field + (label + (identifier) @local.definition.field)) + +(package_identifier) @local.definition.namespace + +(for_clause + (identifier) @local.definition.var + (expression)) + +(for_clause + (identifier) + (identifier) @local.definition.var + (expression)) + +(let_clause + (identifier) @local.definition.var) |
