diff options
| author | Amaan Qureshi <amaanq12@gmail.com> | 2023-03-04 04:31:11 -0500 |
|---|---|---|
| committer | Amaan Qureshi <amaanq12@gmail.com> | 2023-03-04 05:08:18 -0500 |
| commit | 376d74006fd8fff91431639136416ffca4458bfd (patch) | |
| tree | 7793dc6be04b70cd73ec2507271023f393f4b7ff | |
| parent | feat(ecma): add tests for constants (diff) | |
| download | nvim-treesitter-376d74006fd8fff91431639136416ffca4458bfd.tar nvim-treesitter-376d74006fd8fff91431639136416ffca4458bfd.tar.gz nvim-treesitter-376d74006fd8fff91431639136416ffca4458bfd.tar.bz2 nvim-treesitter-376d74006fd8fff91431639136416ffca4458bfd.tar.lz nvim-treesitter-376d74006fd8fff91431639136416ffca4458bfd.tar.xz nvim-treesitter-376d74006fd8fff91431639136416ffca4458bfd.tar.zst nvim-treesitter-376d74006fd8fff91431639136416ffca4458bfd.zip | |
feat: add cue
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | lockfile.json | 3 | ||||
| -rw-r--r-- | lua/nvim-treesitter/parsers.lua | 8 | ||||
| -rw-r--r-- | queries/cue/folds.scm | 5 | ||||
| -rw-r--r-- | queries/cue/highlights.scm | 164 | ||||
| -rw-r--r-- | queries/cue/indents.scm | 21 | ||||
| -rw-r--r-- | queries/cue/injections.scm | 1 | ||||
| -rw-r--r-- | queries/cue/locals.scm | 34 |
8 files changed, 237 insertions, 0 deletions
@@ -196,6 +196,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [cpp](https://github.com/tree-sitter/tree-sitter-cpp) (maintained by @theHamsta) - [x] [css](https://github.com/tree-sitter/tree-sitter-css) (maintained by @TravonteD) - [x] [cuda](https://github.com/theHamsta/tree-sitter-cuda) (maintained by @theHamsta) +- [x] [cue](https://github.com/eonpatapon/tree-sitter-cue) (maintained by @amaanq) - [x] [d](https://github.com/CyberShadow/tree-sitter-d) (experimental, maintained by @nawordar) - [x] [dart](https://github.com/UserNobody14/tree-sitter-dart) (maintained by @akinsho) - [x] [devicetree](https://github.com/joelspadin/tree-sitter-devicetree) (maintained by @jedrzejboczar) diff --git a/lockfile.json b/lockfile.json index 9e795a15f..f1f630267 100644 --- a/lockfile.json +++ b/lockfile.json @@ -68,6 +68,9 @@ "cuda": { "revision": "91c3ca3e42326e0f7b83c82765940bbf7f91c847" }, + "cue": { + "revision": "4ffcda8c2bdfee1c2ba786cd503d0508ea92cca2" + }, "d": { "revision": "c2fbf21bd3aa45495fe13247e040ad5815250032" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 249a1b00a..179513d9b 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -271,6 +271,14 @@ list.cuda = { maintainers = { "@theHamsta" }, } +list.cue = { + install_info = { + url = "https://github.com/eonpatapon/tree-sitter-cue", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@amaanq" }, +} + list.d = { install_info = { url = "https://github.com/CyberShadow/tree-sitter-d", diff --git a/queries/cue/folds.scm b/queries/cue/folds.scm new file mode 100644 index 000000000..934b59e6f --- /dev/null +++ b/queries/cue/folds.scm @@ -0,0 +1,5 @@ +[ + (import_spec_list) + (field) + (string) +] @fold diff --git a/queries/cue/highlights.scm b/queries/cue/highlights.scm new file mode 100644 index 000000000..c1f27fb8f --- /dev/null +++ b/queries/cue/highlights.scm @@ -0,0 +1,164 @@ +; Includes + +[ + "package" + "import" +] @include + +; Namespaces + +(package_identifier) @namespace + +(import_spec ["." "_"] @punctuation.special) + +[ + (attr_path) + (package_path) +] @text.uri ;; In attributes + +; Attributes + +(attribute) @attribute + +; Conditionals + +"if" @conditional + +; Repeats + +[ + "for" +] @repeat + +(for_clause "_" @punctuation.special) + +; Keywords + +[ + "let" +] @keyword + +[ + "in" +] @keyword.operator + +; Operators + +[ + "+" + "-" + "*" + "/" + "|" + "&" + "||" + "&&" + "==" + "!=" + "<" + "<=" + ">" + ">=" + "=~" + "!~" + "!" + "=" +] @operator + +; Fields & Properties + +(field + (label + (identifier) @field)) + +(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 + (#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) @float + +(si_unit + (float) + (_) @symbol) + +(boolean) @boolean + +[ + (null) + (top) + (bottom) +] @constant.builtin + +; Interpolations + +(interpolation "\\(" @punctuation.special (_) ")" @punctuation.special) @none + +(interpolation "\\(" (identifier) @variable ")") + +; Commments + +(comment) @comment @spell + +; Errors + +(ERROR) @error diff --git a/queries/cue/indents.scm b/queries/cue/indents.scm new file mode 100644 index 000000000..731e69b79 --- /dev/null +++ b/queries/cue/indents.scm @@ -0,0 +1,21 @@ +[ + (import_spec_list) + (field) +] @indent + +[ + "}" + "]" + ")" +] @indent_end + +[ "{" "}" ] @branch + +[ "[" "]" ] @branch + +[ "(" ")" ] @branch + +[ + (ERROR) + (comment) +] @auto diff --git a/queries/cue/injections.scm b/queries/cue/injections.scm new file mode 100644 index 000000000..4bb7d675d --- /dev/null +++ b/queries/cue/injections.scm @@ -0,0 +1 @@ +(comment) @comment diff --git a/queries/cue/locals.scm b/queries/cue/locals.scm new file mode 100644 index 000000000..b99a4fca8 --- /dev/null +++ b/queries/cue/locals.scm @@ -0,0 +1,34 @@ +; Scopes + +[ + (source_file) + (field) + (for_clause) +] @scope + +; References + +(identifier) @reference + +; Definitions + +(import_spec + path: (string) @definition.import) + +(field + (label + (identifier) @definition.field)) + +(package_identifier) @definition.namespace + +(for_clause + (identifier) @definition.variable + (expression)) + +(for_clause + (identifier) + (identifier) @definition.variable + (expression)) + +(let_clause + (identifier) @definition.variable) |
