mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-15 01:40:02 -04:00
feat(thrift): update queries based on upstream changes
This commit is contained in:
parent
5b505f5658
commit
3eae9ded42
5 changed files with 151 additions and 115 deletions
|
|
@ -459,7 +459,7 @@
|
||||||
"revision": "0ff887f2a60a147452d52db060de6b42f42f1441"
|
"revision": "0ff887f2a60a147452d52db060de6b42f42f1441"
|
||||||
},
|
},
|
||||||
"thrift": {
|
"thrift": {
|
||||||
"revision": "e0c3e50e17846230e88becdce28fbb1b41dcabba"
|
"revision": "d4deb1bd9e848f2dbe81103a151d99e8546de480"
|
||||||
},
|
},
|
||||||
"tiger": {
|
"tiger": {
|
||||||
"revision": "a233ebe360a73a92c50978e5c4e9e471bc59ff42"
|
"revision": "a233ebe360a73a92c50978e5c4e9e471bc59ff42"
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
[
|
[
|
||||||
(annotation)
|
(annotation_definition)
|
||||||
(enum)
|
(enum_definition)
|
||||||
(exception)
|
(exception_definition)
|
||||||
(function)
|
(function_definition)
|
||||||
(senum)
|
(senum_definition)
|
||||||
(service)
|
(service_definition)
|
||||||
(struct)
|
(struct_definition)
|
||||||
(union)
|
(union_definition)
|
||||||
|
|
||||||
(comment)
|
(comment)
|
||||||
] @fold
|
] @fold
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
; Namespace
|
; Variables
|
||||||
|
|
||||||
(namespace_definition) @namespace
|
((identifier) @variable
|
||||||
|
(#set! "priority" 95))
|
||||||
|
|
||||||
; Includes
|
; Includes
|
||||||
|
|
||||||
|
|
@ -9,10 +10,62 @@
|
||||||
"cpp_include"
|
"cpp_include"
|
||||||
] @include
|
] @include
|
||||||
|
|
||||||
(include_path) @string
|
; Function
|
||||||
(package_path) @string
|
|
||||||
|
|
||||||
; Builtins
|
(function_definition
|
||||||
|
(identifier) @function)
|
||||||
|
|
||||||
|
; Fields
|
||||||
|
|
||||||
|
(field (identifier) @field)
|
||||||
|
|
||||||
|
; Parameters
|
||||||
|
|
||||||
|
(function_definition
|
||||||
|
(parameters
|
||||||
|
(parameter (identifier) @parameter)))
|
||||||
|
|
||||||
|
(throws
|
||||||
|
(parameters
|
||||||
|
(parameter (identifier) @parameter)))
|
||||||
|
|
||||||
|
; Types
|
||||||
|
|
||||||
|
(typedef_identifier) @type
|
||||||
|
(struct_definition
|
||||||
|
"struct" (identifier) @type)
|
||||||
|
|
||||||
|
(union_definition
|
||||||
|
"union" (identifier) @type)
|
||||||
|
|
||||||
|
(exception_definition
|
||||||
|
"exception" (identifier) @type)
|
||||||
|
|
||||||
|
(service_definition
|
||||||
|
"service" (identifier) @type)
|
||||||
|
|
||||||
|
(interaction_definition
|
||||||
|
"interaction" (identifier) @type)
|
||||||
|
|
||||||
|
(type
|
||||||
|
type: (identifier) @type)
|
||||||
|
|
||||||
|
(definition_type
|
||||||
|
type: (identifier) @type)
|
||||||
|
|
||||||
|
((identifier) @type
|
||||||
|
(#lua-match? @type "^[_]*[A-Z]"))
|
||||||
|
|
||||||
|
; Constants
|
||||||
|
|
||||||
|
(const_definition (identifier) @constant)
|
||||||
|
((identifier) @constant
|
||||||
|
(#lua-match? @constant "^[_A-Z][A-Z0-9_]*$"))
|
||||||
|
(enum_definition "enum"
|
||||||
|
. (identifier) @type
|
||||||
|
"{" (identifier) @constant "}")
|
||||||
|
|
||||||
|
; Builtin Types
|
||||||
|
|
||||||
(primitive) @type.builtin
|
(primitive) @type.builtin
|
||||||
|
|
||||||
|
|
@ -25,80 +78,50 @@
|
||||||
"void"
|
"void"
|
||||||
] @type.builtin
|
] @type.builtin
|
||||||
|
|
||||||
; Function
|
; Namespace
|
||||||
|
|
||||||
(function_identifier) @function
|
(namespace_declaration
|
||||||
|
(namespace_scope) @tag
|
||||||
; Fields
|
[(namespace) @namespace (_ (identifier) @namespace)])
|
||||||
|
|
||||||
(field_identifier) @field
|
|
||||||
|
|
||||||
; Parameters
|
|
||||||
|
|
||||||
(param_identifier) @parameter
|
|
||||||
(exception_param_identifier) @parameter
|
|
||||||
|
|
||||||
; Variables
|
|
||||||
|
|
||||||
(identifier) @variable
|
|
||||||
|
|
||||||
; Constants
|
|
||||||
|
|
||||||
(const_identifier) @constant
|
|
||||||
(enum_member) @constant
|
|
||||||
|
|
||||||
; Types
|
|
||||||
|
|
||||||
(enum_identifier) @type
|
|
||||||
(definition_type) @type
|
|
||||||
(exception_identifier) @type
|
|
||||||
(exception_param_type) @type
|
|
||||||
(field_type) @type
|
|
||||||
(param_type) @type
|
|
||||||
(type_identifier) @type
|
|
||||||
|
|
||||||
; Attributes
|
; Attributes
|
||||||
|
|
||||||
(annotation_identifier) @attribute
|
(annotation_definition
|
||||||
(uri_def) @attribute
|
(annotation_identifier (identifier) @attribute))
|
||||||
|
(fb_annotation_definition
|
||||||
|
"@" @attribute (annotation_identifier (identifier) @attribute)
|
||||||
|
(identifier)? @attribute)
|
||||||
|
(namespace_uri (string) @attribute)
|
||||||
|
|
||||||
; Operators
|
; Operators
|
||||||
|
|
||||||
[
|
[
|
||||||
"="
|
"="
|
||||||
"+"
|
"&"
|
||||||
"-"
|
|
||||||
] @operator
|
] @operator
|
||||||
|
|
||||||
; Exceptions
|
; Exceptions
|
||||||
|
|
||||||
[
|
[
|
||||||
"throws"
|
"throws"
|
||||||
] @exception
|
] @exception
|
||||||
|
|
||||||
; Keywords
|
; Keywords
|
||||||
|
|
||||||
[
|
[
|
||||||
"cpp_include"
|
|
||||||
"enum"
|
"enum"
|
||||||
"exception"
|
"exception"
|
||||||
"extends"
|
"extends"
|
||||||
"include"
|
|
||||||
"interaction"
|
"interaction"
|
||||||
"namespace"
|
"namespace"
|
||||||
"optional"
|
|
||||||
"required"
|
|
||||||
"senum"
|
"senum"
|
||||||
"service"
|
"service"
|
||||||
"struct"
|
"struct"
|
||||||
"typedef"
|
"typedef"
|
||||||
"union"
|
"union"
|
||||||
|
"uri"
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
[
|
|
||||||
"oneway"
|
|
||||||
] @keyword.coroutine
|
|
||||||
|
|
||||||
; Deprecated Keywords
|
; Deprecated Keywords
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -120,35 +143,41 @@
|
||||||
"xsd_optional"
|
"xsd_optional"
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
|
; Extended Kewords
|
||||||
|
[
|
||||||
|
"package"
|
||||||
|
"performs"
|
||||||
|
] @keyword
|
||||||
|
|
||||||
[
|
[
|
||||||
"async"
|
"async"
|
||||||
|
"oneway"
|
||||||
] @keyword.coroutine
|
] @keyword.coroutine
|
||||||
|
|
||||||
; Extended Keywords
|
; Qualifiers
|
||||||
|
|
||||||
[
|
[
|
||||||
"client"
|
"client"
|
||||||
|
"const"
|
||||||
"idempotent"
|
"idempotent"
|
||||||
"package"
|
"optional"
|
||||||
"performs"
|
|
||||||
"permanent"
|
"permanent"
|
||||||
"readonly"
|
"readonly"
|
||||||
"server"
|
"required"
|
||||||
"safe"
|
"safe"
|
||||||
|
"server"
|
||||||
"stateful"
|
"stateful"
|
||||||
"transient"
|
"transient"
|
||||||
] @keyword
|
] @type.qualifier
|
||||||
|
|
||||||
; Literals
|
; Literals
|
||||||
|
|
||||||
[
|
(string) @string
|
||||||
(annotation_value)
|
|
||||||
(string)
|
|
||||||
] @string
|
|
||||||
|
|
||||||
(escape_sequence) @string.escape
|
(escape_sequence) @string.escape
|
||||||
|
|
||||||
(uri (string_fragment) @text.uri) @string.special
|
(namespace_uri
|
||||||
|
(string) @text.uri @string.special)
|
||||||
|
|
||||||
(number) @number
|
(number) @number
|
||||||
|
|
||||||
|
|
@ -158,24 +187,12 @@
|
||||||
|
|
||||||
; Typedefs
|
; Typedefs
|
||||||
|
|
||||||
(typedef_definition) @type.definition
|
(typedef_identifier) @type.definition
|
||||||
(namespace_scope) @type.definition
|
|
||||||
|
|
||||||
; Qualifiers
|
|
||||||
|
|
||||||
[
|
|
||||||
"const"
|
|
||||||
(exception_modifier)
|
|
||||||
(field_modifier)
|
|
||||||
(function_modifier)
|
|
||||||
] @type.qualifier
|
|
||||||
|
|
||||||
; Punctuation
|
; Punctuation
|
||||||
|
|
||||||
[
|
[
|
||||||
"*"
|
"*"
|
||||||
"&"
|
|
||||||
"@"
|
|
||||||
] @punctuation.special
|
] @punctuation.special
|
||||||
|
|
||||||
["{" "}"] @punctuation.bracket
|
["{" "}"] @punctuation.bracket
|
||||||
|
|
@ -187,14 +204,12 @@
|
||||||
["<" ">"] @punctuation.bracket
|
["<" ">"] @punctuation.bracket
|
||||||
|
|
||||||
[
|
[
|
||||||
";"
|
"."
|
||||||
","
|
","
|
||||||
|
";"
|
||||||
|
":"
|
||||||
] @punctuation.delimiter
|
] @punctuation.delimiter
|
||||||
|
|
||||||
; Errors
|
|
||||||
|
|
||||||
(invalid) @error
|
|
||||||
|
|
||||||
; Comments
|
; Comments
|
||||||
|
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
@ -206,3 +221,10 @@
|
||||||
(#lua-match? @comment.documentation "^///[^/]"))
|
(#lua-match? @comment.documentation "^///[^/]"))
|
||||||
((comment) @comment.documentation
|
((comment) @comment.documentation
|
||||||
(#lua-match? @comment.documentation "^///$"))
|
(#lua-match? @comment.documentation "^///$"))
|
||||||
|
|
||||||
|
((comment) @preproc
|
||||||
|
(#lua-match? @preproc "#!.*"))
|
||||||
|
|
||||||
|
; Errors
|
||||||
|
|
||||||
|
(ERROR) @error
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,6 @@
|
||||||
(definition) @indent
|
(definition) @indent
|
||||||
|
|
||||||
; (function (function_identifier) @aligned_indent)
|
((parameters (parameter)) @aligned_indent
|
||||||
|
|
||||||
((function_parameters (function_parameter)) @aligned_indent
|
|
||||||
(#set! "delimiter" "()"))
|
|
||||||
|
|
||||||
((exception_parameters (exception_parameter)) @aligned_indent
|
|
||||||
(#set! "delimiter" "()"))
|
(#set! "delimiter" "()"))
|
||||||
|
|
||||||
"}" @indent_end
|
"}" @indent_end
|
||||||
|
|
@ -15,6 +10,6 @@
|
||||||
[ "(" ")" ] @branch
|
[ "(" ")" ] @branch
|
||||||
|
|
||||||
[
|
[
|
||||||
(ERROR)
|
(ERROR)
|
||||||
(comment)
|
(comment)
|
||||||
] @auto
|
] @auto
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,51 @@
|
||||||
(document) @scope
|
; Scopes
|
||||||
(definition) @scope
|
|
||||||
|
|
||||||
[
|
[
|
||||||
(identifier)
|
(document)
|
||||||
(field_type)
|
(definition)
|
||||||
(custom_type)
|
] @scope
|
||||||
] @reference
|
|
||||||
(const_value (const_identifier) @reference)
|
; References
|
||||||
|
|
||||||
|
(identifier) @reference
|
||||||
|
|
||||||
|
; Definitions
|
||||||
|
|
||||||
(annotation_identifier) @definition
|
(annotation_identifier) @definition
|
||||||
|
|
||||||
(const (const_identifier) @definition.constant)
|
(const_definition (identifier) @definition.constant)
|
||||||
(enum_member) @definition.constant
|
|
||||||
|
|
||||||
(enum_identifier) @definition.enum
|
(enum_definition "enum"
|
||||||
|
. (identifier) @definition.enum
|
||||||
|
"{" (identifier) @definition.constant "}")
|
||||||
|
|
||||||
(field_identifier) @definition.field
|
(senum_definition "senum"
|
||||||
|
. (identifier) @definition.enum)
|
||||||
|
|
||||||
(function_identifier) @definition.function
|
(field (identifier) @definition.field)
|
||||||
|
|
||||||
(namespace_definition) @definition.namespace
|
(function_definition (identifier) @definition.function)
|
||||||
|
|
||||||
[
|
(namespace_declaration
|
||||||
(param_identifier)
|
"namespace" (namespace_scope)
|
||||||
(exception_param_identifier)
|
. (_) @definition.namespace
|
||||||
] @definition.parameter
|
(namespace_uri)?)
|
||||||
|
|
||||||
[
|
(parameter (identifier) @definition.parameter)
|
||||||
(type_identifier)
|
|
||||||
(exception_identifier)
|
(struct_definition
|
||||||
] @definition.type
|
"struct" . (identifier) @definition.type)
|
||||||
|
|
||||||
|
(union_definition
|
||||||
|
"union" . (identifier) @definition.type)
|
||||||
|
|
||||||
|
(exception_definition
|
||||||
|
"exception" . (identifier) @definition.type)
|
||||||
|
|
||||||
|
(service_definition
|
||||||
|
"service" . (identifier) @definition.type)
|
||||||
|
|
||||||
|
(interaction_definition
|
||||||
|
"interaction" . (identifier) @definition.type)
|
||||||
|
|
||||||
|
(typedef_identifier) @definition.type
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue