mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
feat(capnp): improve queries
This commit is contained in:
parent
ba35d094c1
commit
454876fc6d
5 changed files with 150 additions and 21 deletions
|
|
@ -33,7 +33,7 @@
|
|||
"revision": "5b6c4d0d19d79b05c69ad752e11829910e3b4610"
|
||||
},
|
||||
"capnp": {
|
||||
"revision": "cb85cddfdf398530110c807ba046822dbaee6afb"
|
||||
"revision": "9ed3aa8c212cddc94dca087cfe2c30d43234c867"
|
||||
},
|
||||
"chatito": {
|
||||
"revision": "3baf22e7e507cedf15d1dbc03df8afa50a625586"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
; Preproc (?)
|
||||
; Preproc
|
||||
|
||||
(unique_id) @preproc
|
||||
(top_level_annotation_body) @preproc
|
||||
|
|
@ -13,18 +13,12 @@
|
|||
|
||||
(import_path) @string
|
||||
|
||||
; Types
|
||||
|
||||
(primitive_type) @type.builtin
|
||||
; Builtins
|
||||
|
||||
[
|
||||
"annotation"
|
||||
"enum"
|
||||
"group"
|
||||
"interface"
|
||||
"struct"
|
||||
"union"
|
||||
] @keyword
|
||||
(primitive_type)
|
||||
"List"
|
||||
] @type.builtin
|
||||
|
||||
; Typedefs
|
||||
|
||||
|
|
@ -52,10 +46,6 @@
|
|||
(param_identifier) @parameter
|
||||
(return_identifier) @parameter
|
||||
|
||||
; Variables
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
; Constants
|
||||
|
||||
(const_identifier) @constant
|
||||
|
|
@ -68,8 +58,6 @@
|
|||
|
||||
(enum_identifier) @type
|
||||
(extend_type) @type
|
||||
(field_type) @type
|
||||
(generic_identifier) @type
|
||||
(type_identifier) @type
|
||||
|
||||
; Attributes
|
||||
|
|
@ -86,6 +74,16 @@
|
|||
|
||||
; Keywords
|
||||
|
||||
|
||||
[
|
||||
"annotation"
|
||||
"enum"
|
||||
"group"
|
||||
"interface"
|
||||
"struct"
|
||||
"union"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"extends"
|
||||
"namespace"
|
||||
|
|
@ -95,11 +93,16 @@
|
|||
|
||||
; Literals
|
||||
|
||||
(string_literal) @string
|
||||
(block_text) @string
|
||||
[
|
||||
(string)
|
||||
(concatenated_string)
|
||||
(block_text)
|
||||
(namespace)
|
||||
] @string
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(data_string) @string.special
|
||||
(namespace) @string.special
|
||||
|
||||
(number) @number
|
||||
|
||||
|
|
@ -116,6 +119,7 @@
|
|||
[
|
||||
"*"
|
||||
"$"
|
||||
":"
|
||||
] @punctuation.special
|
||||
|
||||
["{" "}"] @punctuation.bracket
|
||||
|
|
|
|||
34
queries/capnp/indents.scm
Normal file
34
queries/capnp/indents.scm
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[
|
||||
(annotation_targets)
|
||||
(const_list)
|
||||
(enum)
|
||||
(interface)
|
||||
(implicit_generics)
|
||||
(generics)
|
||||
(group)
|
||||
(method_parameters)
|
||||
(named_return_types)
|
||||
(struct)
|
||||
(struct_shorthand)
|
||||
(union)
|
||||
] @indent
|
||||
|
||||
((struct_shorthand (property)) @aligned_indent
|
||||
(#set! "delimiter" "()"))
|
||||
|
||||
((const_list (const_value)) @aligned_indent
|
||||
(#set! "delimiter" "[]"))
|
||||
|
||||
[
|
||||
"}"
|
||||
")"
|
||||
] @indent_end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @auto
|
||||
1
queries/capnp/injections.scm
Normal file
1
queries/capnp/injections.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
(comment) @comment
|
||||
90
queries/capnp/locals.scm
Normal file
90
queries/capnp/locals.scm
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
[
|
||||
(message)
|
||||
(annotation_targets)
|
||||
(const_list)
|
||||
(enum)
|
||||
(interface)
|
||||
(implicit_generics)
|
||||
(generics)
|
||||
(group)
|
||||
(method_parameters)
|
||||
(named_return_types)
|
||||
(struct)
|
||||
(struct_shorthand)
|
||||
(union)
|
||||
] @scope
|
||||
|
||||
[
|
||||
(extend_type)
|
||||
(field_type)
|
||||
] @reference
|
||||
(custom_type (type_identifier) @reference)
|
||||
(custom_type
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @reference)))
|
||||
|
||||
(annotation_definition_identifier) @definition
|
||||
|
||||
(const_identifier) @definition.constant
|
||||
|
||||
(enum (enum_identifier) @definition.enum)
|
||||
|
||||
[
|
||||
(enum_member)
|
||||
(field_identifier)
|
||||
] @definition.field
|
||||
|
||||
(method_identifier) @definition.method
|
||||
|
||||
(namespace) @definition.namespace
|
||||
|
||||
[
|
||||
(param_identifier)
|
||||
(return_identifier)
|
||||
] @definition.parameter
|
||||
|
||||
(group (type_identifier) @definition.type)
|
||||
|
||||
(struct (type_identifier) @definition.type)
|
||||
|
||||
(union (type_identifier) @definition.type)
|
||||
|
||||
(interface (type_identifier) @definition.type)
|
||||
|
||||
; Generics Related (don't know how to combine these)
|
||||
|
||||
(struct
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.parameter)))
|
||||
|
||||
(interface
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.parameter)))
|
||||
|
||||
(method
|
||||
(implicit_generics
|
||||
(implicit_generic_parameters
|
||||
(generic_identifier) @definition.parameter)))
|
||||
|
||||
(method
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.parameter)))
|
||||
|
||||
(annotation
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.type)))
|
||||
|
||||
(replace_using
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.type)))
|
||||
|
||||
(return_type
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.type)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue