aboutsummaryrefslogtreecommitdiffstats
path: root/queries/capnp
diff options
context:
space:
mode:
authorAmaan Qureshi <amaanq12@gmail.com>2023-05-06 11:12:49 -0400
committerGitHub <noreply@github.com>2023-05-07 00:12:49 +0900
commit12453e0e3d2e82a4ae813f1540315c7cf2df2363 (patch)
tree8f7a425d64891b804c8baacbbd7b53c78130d8a8 /queries/capnp
parentUpdate parsers: haskell, vim, vimdoc (diff)
downloadnvim-treesitter-12453e0e3d2e82a4ae813f1540315c7cf2df2363.tar
nvim-treesitter-12453e0e3d2e82a4ae813f1540315c7cf2df2363.tar.gz
nvim-treesitter-12453e0e3d2e82a4ae813f1540315c7cf2df2363.tar.bz2
nvim-treesitter-12453e0e3d2e82a4ae813f1540315c7cf2df2363.tar.lz
nvim-treesitter-12453e0e3d2e82a4ae813f1540315c7cf2df2363.tar.xz
nvim-treesitter-12453e0e3d2e82a4ae813f1540315c7cf2df2363.tar.zst
nvim-treesitter-12453e0e3d2e82a4ae813f1540315c7cf2df2363.zip
Update Capnp (#4713)
* feat(capnp): update queries from upstream changes * test: add tests for capnp * fix indent queries * ci: fix capnp indent tests --------- Co-authored-by: Pham Huy Hoang <hoangtun0810@gmail.com>
Diffstat (limited to 'queries/capnp')
-rw-r--r--queries/capnp/highlights.scm101
-rw-r--r--queries/capnp/indents.scm18
2 files changed, 67 insertions, 52 deletions
diff --git a/queries/capnp/highlights.scm b/queries/capnp/highlights.scm
index 8dfb2ba91..780f03675 100644
--- a/queries/capnp/highlights.scm
+++ b/queries/capnp/highlights.scm
@@ -1,7 +1,9 @@
; Preproc
-(unique_id) @preproc
-(top_level_annotation_body) @preproc
+[
+ (unique_id)
+ (top_level_annotation_body)
+] @preproc
; Includes
@@ -9,13 +11,31 @@
"import"
"$import"
"embed"
+ "using"
] @include
-(import_path) @string
+(import_path) @string @text.uri
+
+; Keywords
+
+[
+ "annotation"
+ "enum"
+ "group"
+ "interface"
+ "struct"
+ "union"
+ "extends"
+ "namespace"
+] @keyword
; Builtins
[
+ "const"
+] @type.qualifier
+
+[
(primitive_type)
"List"
] @type.builtin
@@ -30,8 +50,10 @@
; Methods
-(annotation_definition_identifier) @method
-(method_identifier) @method
+[
+ (annotation_definition_identifier)
+ (method_identifier)
+] @method
; Fields
@@ -43,53 +65,41 @@
; Parameters
-(param_identifier) @parameter
-(return_identifier) @parameter
+[
+ (param_identifier)
+ (return_identifier)
+] @parameter
+
+(annotation_target) @parameter.builtin
; Constants
-(const_identifier) @constant
-(local_const) @constant
-(enum_member) @constant
+[
+ (const_identifier)
+ (local_const)
+ (enum_member)
+] @constant
(void) @constant.builtin
; Types
-(enum_identifier) @type
-(extend_type) @type
-(type_identifier) @type
+[
+ (enum_identifier)
+ (extend_type)
+ (type_identifier)
+] @type
; Attributes
-(annotation_identifier) @attribute
-(attribute) @attribute
-
-; Operators
-
[
- ; @ ! -
- "="
-] @operator
+ (annotation_identifier)
+ (attribute)
+] @attribute
-; Keywords
-
-
-[
- "annotation"
- "enum"
- "group"
- "interface"
- "struct"
- "union"
-] @keyword
+; Operators
-[
- "extends"
- "namespace"
- "using"
- (annotation_target)
-] @keyword
+"=" @operator
; Literals
@@ -100,6 +110,8 @@
(namespace)
] @string
+(namespace) @text.underline
+
(escape_sequence) @string.escape
(data_string) @string.special
@@ -110,11 +122,9 @@
(boolean) @boolean
-; Misc
+(data_hex) @symbol
-[
- "const"
-] @type.qualifier
+; Punctuation
[
"*"
@@ -129,13 +139,16 @@
["[" "]"] @punctuation.bracket
[
+ "."
","
";"
"->"
] @punctuation.delimiter
-(data_hex) @symbol
-
; Comments
(comment) @comment @spell
+
+; Errors
+
+(ERROR) @error
diff --git a/queries/capnp/indents.scm b/queries/capnp/indents.scm
index e54ca9566..bc7979aea 100644
--- a/queries/capnp/indents.scm
+++ b/queries/capnp/indents.scm
@@ -1,6 +1,6 @@
[
(annotation_targets)
- (const_list)
+ (const)
(enum)
(interface)
(implicit_generics)
@@ -9,26 +9,28 @@
(method_parameters)
(named_return_types)
(struct)
- (struct_shorthand)
(union)
+ (field)
] @indent.begin
((struct_shorthand (property)) @indent.align
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")"))
+((method (field_version)) @indent.align
+ (#set! indent.open_delimiter field_version))
+
((const_list (const_value)) @indent.align
- (#set! indent.open_delimiter "(")
- (#set! indent.close_delimiter ")"))
+ (#set! indent.open_delimiter "[")
+ (#set! indent.close_delimiter "]"))
+
+(concatenated_string) @indent.align
[
"}"
")"
-] @indent.end
-
-[ "{" "}" ] @indent.branch
+] @indent.end @indent.branch
-[ "(" ")" ] @indent.branch
[
(ERROR)