mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17: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"
|
||||
},
|
||||
"thrift": {
|
||||
"revision": "e0c3e50e17846230e88becdce28fbb1b41dcabba"
|
||||
"revision": "d4deb1bd9e848f2dbe81103a151d99e8546de480"
|
||||
},
|
||||
"tiger": {
|
||||
"revision": "a233ebe360a73a92c50978e5c4e9e471bc59ff42"
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
[
|
||||
(annotation)
|
||||
(enum)
|
||||
(exception)
|
||||
(function)
|
||||
(senum)
|
||||
(service)
|
||||
(struct)
|
||||
(union)
|
||||
(annotation_definition)
|
||||
(enum_definition)
|
||||
(exception_definition)
|
||||
(function_definition)
|
||||
(senum_definition)
|
||||
(service_definition)
|
||||
(struct_definition)
|
||||
(union_definition)
|
||||
|
||||
(comment)
|
||||
] @fold
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
; Namespace
|
||||
; Variables
|
||||
|
||||
(namespace_definition) @namespace
|
||||
((identifier) @variable
|
||||
(#set! "priority" 95))
|
||||
|
||||
; Includes
|
||||
|
||||
|
|
@ -9,10 +10,62 @@
|
|||
"cpp_include"
|
||||
] @include
|
||||
|
||||
(include_path) @string
|
||||
(package_path) @string
|
||||
; Function
|
||||
|
||||
; 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
|
||||
|
||||
|
|
@ -25,80 +78,50 @@
|
|||
"void"
|
||||
] @type.builtin
|
||||
|
||||
; Function
|
||||
; Namespace
|
||||
|
||||
(function_identifier) @function
|
||||
|
||||
; Fields
|
||||
|
||||
(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
|
||||
(namespace_declaration
|
||||
(namespace_scope) @tag
|
||||
[(namespace) @namespace (_ (identifier) @namespace)])
|
||||
|
||||
; Attributes
|
||||
|
||||
(annotation_identifier) @attribute
|
||||
(uri_def) @attribute
|
||||
(annotation_definition
|
||||
(annotation_identifier (identifier) @attribute))
|
||||
(fb_annotation_definition
|
||||
"@" @attribute (annotation_identifier (identifier) @attribute)
|
||||
(identifier)? @attribute)
|
||||
(namespace_uri (string) @attribute)
|
||||
|
||||
; Operators
|
||||
|
||||
[
|
||||
"="
|
||||
"+"
|
||||
"-"
|
||||
"="
|
||||
"&"
|
||||
] @operator
|
||||
|
||||
; Exceptions
|
||||
|
||||
[
|
||||
"throws"
|
||||
"throws"
|
||||
] @exception
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"cpp_include"
|
||||
"enum"
|
||||
"exception"
|
||||
"extends"
|
||||
"include"
|
||||
"interaction"
|
||||
"namespace"
|
||||
"optional"
|
||||
"required"
|
||||
"senum"
|
||||
"service"
|
||||
"struct"
|
||||
"typedef"
|
||||
"union"
|
||||
"uri"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"oneway"
|
||||
] @keyword.coroutine
|
||||
|
||||
; Deprecated Keywords
|
||||
|
||||
[
|
||||
|
|
@ -120,35 +143,41 @@
|
|||
"xsd_optional"
|
||||
] @keyword
|
||||
|
||||
; Extended Kewords
|
||||
[
|
||||
"package"
|
||||
"performs"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"async"
|
||||
"oneway"
|
||||
] @keyword.coroutine
|
||||
|
||||
; Extended Keywords
|
||||
; Qualifiers
|
||||
|
||||
[
|
||||
"client"
|
||||
"const"
|
||||
"idempotent"
|
||||
"package"
|
||||
"performs"
|
||||
"optional"
|
||||
"permanent"
|
||||
"readonly"
|
||||
"server"
|
||||
"required"
|
||||
"safe"
|
||||
"server"
|
||||
"stateful"
|
||||
"transient"
|
||||
] @keyword
|
||||
] @type.qualifier
|
||||
|
||||
; Literals
|
||||
|
||||
[
|
||||
(annotation_value)
|
||||
(string)
|
||||
] @string
|
||||
(string) @string
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(uri (string_fragment) @text.uri) @string.special
|
||||
(namespace_uri
|
||||
(string) @text.uri @string.special)
|
||||
|
||||
(number) @number
|
||||
|
||||
|
|
@ -158,24 +187,12 @@
|
|||
|
||||
; Typedefs
|
||||
|
||||
(typedef_definition) @type.definition
|
||||
(namespace_scope) @type.definition
|
||||
|
||||
; Qualifiers
|
||||
|
||||
[
|
||||
"const"
|
||||
(exception_modifier)
|
||||
(field_modifier)
|
||||
(function_modifier)
|
||||
] @type.qualifier
|
||||
(typedef_identifier) @type.definition
|
||||
|
||||
; Punctuation
|
||||
|
||||
[
|
||||
"*"
|
||||
"&"
|
||||
"@"
|
||||
] @punctuation.special
|
||||
|
||||
["{" "}"] @punctuation.bracket
|
||||
|
|
@ -187,14 +204,12 @@
|
|||
["<" ">"] @punctuation.bracket
|
||||
|
||||
[
|
||||
";"
|
||||
"."
|
||||
","
|
||||
";"
|
||||
":"
|
||||
] @punctuation.delimiter
|
||||
|
||||
; Errors
|
||||
|
||||
(invalid) @error
|
||||
|
||||
; Comments
|
||||
|
||||
(comment) @comment @spell
|
||||
|
|
@ -206,3 +221,10 @@
|
|||
(#lua-match? @comment.documentation "^///[^/]"))
|
||||
((comment) @comment.documentation
|
||||
(#lua-match? @comment.documentation "^///$"))
|
||||
|
||||
((comment) @preproc
|
||||
(#lua-match? @preproc "#!.*"))
|
||||
|
||||
; Errors
|
||||
|
||||
(ERROR) @error
|
||||
|
|
|
|||
|
|
@ -1,11 +1,6 @@
|
|||
(definition) @indent
|
||||
|
||||
; (function (function_identifier) @aligned_indent)
|
||||
|
||||
((function_parameters (function_parameter)) @aligned_indent
|
||||
(#set! "delimiter" "()"))
|
||||
|
||||
((exception_parameters (exception_parameter)) @aligned_indent
|
||||
((parameters (parameter)) @aligned_indent
|
||||
(#set! "delimiter" "()"))
|
||||
|
||||
"}" @indent_end
|
||||
|
|
@ -15,6 +10,6 @@
|
|||
[ "(" ")" ] @branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @auto
|
||||
|
|
|
|||
|
|
@ -1,32 +1,51 @@
|
|||
(document) @scope
|
||||
(definition) @scope
|
||||
; Scopes
|
||||
|
||||
[
|
||||
(identifier)
|
||||
(field_type)
|
||||
(custom_type)
|
||||
] @reference
|
||||
(const_value (const_identifier) @reference)
|
||||
(document)
|
||||
(definition)
|
||||
] @scope
|
||||
|
||||
; References
|
||||
|
||||
(identifier) @reference
|
||||
|
||||
; Definitions
|
||||
|
||||
(annotation_identifier) @definition
|
||||
|
||||
(const (const_identifier) @definition.constant)
|
||||
(enum_member) @definition.constant
|
||||
(const_definition (identifier) @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)
|
||||
|
||||
[
|
||||
(param_identifier)
|
||||
(exception_param_identifier)
|
||||
] @definition.parameter
|
||||
(namespace_declaration
|
||||
"namespace" (namespace_scope)
|
||||
. (_) @definition.namespace
|
||||
(namespace_uri)?)
|
||||
|
||||
[
|
||||
(type_identifier)
|
||||
(exception_identifier)
|
||||
] @definition.type
|
||||
(parameter (identifier) @definition.parameter)
|
||||
|
||||
(struct_definition
|
||||
"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