aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmaan Qureshi <amaanq12@gmail.com>2023-01-23 03:00:32 -0500
committerGitHub <noreply@github.com>2023-01-23 10:00:32 +0200
commit6cf93175bf011ca899e494376838ae147870a1eb (patch)
tree4a1c697faaabcf4ad2e63f0baad85017fa6083c7
parentfeat(thrift): refactor queries for better highlights, fixes bugs where certai... (diff)
downloadnvim-treesitter-6cf93175bf011ca899e494376838ae147870a1eb.tar
nvim-treesitter-6cf93175bf011ca899e494376838ae147870a1eb.tar.gz
nvim-treesitter-6cf93175bf011ca899e494376838ae147870a1eb.tar.bz2
nvim-treesitter-6cf93175bf011ca899e494376838ae147870a1eb.tar.lz
nvim-treesitter-6cf93175bf011ca899e494376838ae147870a1eb.tar.xz
nvim-treesitter-6cf93175bf011ca899e494376838ae147870a1eb.tar.zst
nvim-treesitter-6cf93175bf011ca899e494376838ae147870a1eb.zip
feat: add capnp (#4203)
-rw-r--r--README.md1
-rw-r--r--lockfile.json3
-rw-r--r--lua/nvim-treesitter/parsers.lua9
-rw-r--r--queries/capnp/highlights.scm124
4 files changed, 137 insertions, 0 deletions
diff --git a/README.md b/README.md
index a85ad44ce..852f2a921 100644
--- a/README.md
+++ b/README.md
@@ -182,6 +182,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [bibtex](https://github.com/latex-lsp/tree-sitter-bibtex) (maintained by @theHamsta, @clason)
- [x] [blueprint](https://gitlab.com/gabmus/tree-sitter-blueprint.git) (experimental, maintained by @gabmus)
- [x] [c](https://github.com/tree-sitter/tree-sitter-c) (maintained by @vigoux)
+- [x] [capnp](https://github.com/amaanq/tree-sitter-capnp) (experimental, maintained by @amaanq)
- [x] [c_sharp](https://github.com/tree-sitter/tree-sitter-c-sharp) (maintained by @Luxed)
- [x] [clojure](https://github.com/sogaiu/tree-sitter-clojure) (maintained by @sogaiu)
- [x] [cmake](https://github.com/uyha/tree-sitter-cmake) (maintained by @uyha)
diff --git a/lockfile.json b/lockfile.json
index b57597cc8..d68dd0fb5 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -29,6 +29,9 @@
"c": {
"revision": "7175a6dd5fc1cee660dce6fe23f6043d75af424a"
},
+ "capnp": {
+ "revision": "fda654c12f29ec70309d9573bc0af16b7124384e"
+ },
"c_sharp": {
"revision": "a29bac0681802139710b4d3875540901504d15cb"
},
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index e4d1da4d9..583466b99 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -1195,6 +1195,15 @@ list.astro = {
maintainers = { "@virchau13" },
}
+list.capnp = {
+ install_info = {
+ url = "https://github.com/amaanq/tree-sitter-capnp",
+ files = { "src/parser.c" },
+ },
+ maintainers = { "@amaanq" },
+ experimental = true,
+}
+
list.wgsl = {
install_info = {
url = "https://github.com/szebniok/tree-sitter-wgsl",
diff --git a/queries/capnp/highlights.scm b/queries/capnp/highlights.scm
new file mode 100644
index 000000000..0f6815aa6
--- /dev/null
+++ b/queries/capnp/highlights.scm
@@ -0,0 +1,124 @@
+; Preproc (?)
+
+(unique_id) @preproc
+
+; Includes
+
+[
+ "import"
+ "$import"
+ "embed"
+] @include
+
+(import_path) @string
+
+; Types
+
+(primitive_type) @type.builtin
+
+[
+ "annotation"
+ "enum"
+ "group"
+ "interface"
+ "List"
+ "struct"
+ "union"
+] @type.builtin
+
+; Typedefs
+
+(type_definition) @type.definition
+
+; Labels (@number, @number!)
+
+(field_version) @label
+
+; Methods
+
+(method_identifier) @method
+
+; Fields
+
+(field_identifier) @field
+
+; Parameters
+
+(param_identifier) @parameter
+(return_identifier) @parameter
+
+; Variables
+
+(identifier) @variable
+
+; Constants
+
+(const_identifier) @constant
+(enum_member) @constant
+
+; Types
+
+(enum_identifier) @type
+(extend_type) @type
+(field_type) @type
+(generic_identifier) @type
+(type_identifier) @type
+
+; Attributes
+
+(attribute) @attribute
+(annotation_identifier) @attribute
+
+; Operators
+
+[
+ ; @ ! -
+ "="
+] @operator
+
+; Keywords
+
+[
+ "extends"
+ "namespace"
+ "using"
+] @keyword
+
+; Literals
+
+(string_literal) @string
+
+(data_string) @string.special
+(namespace) @string.special
+
+(number) @number
+
+(float) @float
+
+(boolean) @boolean
+
+; Misc
+
+[
+ "const"
+] @type.qualifier
+
+[
+ "*"
+] @punctuation.special
+
+["{" "}"] @punctuation.bracket
+
+["(" ")"] @punctuation.bracket
+
+["[" "]"] @punctuation.bracket
+
+[
+ ","
+ ";"
+ "->"
+] @punctuation.delimiter
+
+; Comments
+
+(comment) @comment @spell