nvim-treesitter/queries/thrift/highlights.scm

231 lines
3.1 KiB
Scheme
Raw Normal View History

; Variables
2023-01-21 07:39:15 -05:00
((identifier) @variable
(#set! "priority" 95))
2023-01-21 07:39:15 -05:00
; Includes
2023-01-28 15:47:47 -05:00
[
"include"
2023-01-21 07:39:15 -05:00
"cpp_include"
] @include
; Function
2023-01-21 07:39:15 -05:00
(function_definition
(identifier) @function)
2023-01-21 07:39:15 -05:00
; Fields
2023-01-21 07:39:15 -05:00
(field (identifier) @field)
2023-01-21 07:39:15 -05:00
; Parameters
2023-01-21 07:39:15 -05:00
(function_definition
(parameters
(parameter (identifier) @parameter)))
2023-01-21 07:39:15 -05:00
(throws
(parameters
(parameter (identifier) @parameter)))
2023-01-21 07:39:15 -05:00
; Types
2023-01-21 07:39:15 -05:00
(typedef_identifier) @type
(struct_definition
"struct" (identifier) @type)
2023-01-21 07:39:15 -05:00
(union_definition
"union" (identifier) @type)
2023-01-21 07:39:15 -05:00
(exception_definition
"exception" (identifier) @type)
(service_definition
"service" (identifier) @type)
(interaction_definition
"interaction" (identifier) @type)
2023-01-21 07:39:15 -05:00
(type
type: (identifier) @type)
(definition_type
type: (identifier) @type)
((identifier) @type
(#lua-match? @type "^[_]*[A-Z]"))
2023-01-21 07:39:15 -05:00
; 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
[
"list"
"map"
"set"
"sink"
"stream"
"void"
] @type.builtin
; Namespace
(namespace_declaration
(namespace_scope) @tag
[(namespace) @namespace (_ (identifier) @namespace)])
; Attributes
(annotation_definition
(annotation_identifier (identifier) @attribute))
(fb_annotation_definition
"@" @attribute (annotation_identifier (identifier) @attribute)
(identifier)? @attribute)
(namespace_uri (string) @attribute)
2023-01-21 07:39:15 -05:00
; Operators
[
"="
"&"
2023-01-21 07:39:15 -05:00
] @operator
; Exceptions
[
"throws"
2023-01-21 07:39:15 -05:00
] @exception
; Keywords
[
"enum"
"exception"
"extends"
2023-01-28 15:47:47 -05:00
"interaction"
2023-01-21 07:39:15 -05:00
"namespace"
"senum"
"service"
"struct"
"typedef"
"union"
"uri"
2023-01-21 07:39:15 -05:00
] @keyword
; Deprecated Keywords
2023-01-21 07:39:15 -05:00
[
"cocoa_prefix"
"cpp_namespace"
"csharp_namespace"
"delphi_namespace"
"java_package"
"perl_package"
"php_namespace"
"py_module"
"ruby_namespace"
"smalltalk_category"
"smalltalk_prefix"
"xsd_all"
"xsd_attrs"
"xsd_namespace"
"xsd_nillable"
"xsd_optional"
] @keyword
2023-03-21 13:50:54 +08:00
; Extended Keywords
[
"package"
"performs"
] @keyword
[
"async"
"oneway"
] @keyword.coroutine
; Qualifiers
2023-01-28 15:47:47 -05:00
[
"client"
"const"
2023-01-28 15:47:47 -05:00
"idempotent"
"optional"
2023-01-28 15:47:47 -05:00
"permanent"
"readonly"
"required"
2023-01-28 15:47:47 -05:00
"safe"
"server"
2023-01-28 15:47:47 -05:00
"stateful"
"transient"
] @type.qualifier
2023-01-21 07:39:15 -05:00
; Literals
(string) @string
2023-01-28 15:47:47 -05:00
(escape_sequence) @string.escape
2023-01-21 07:39:15 -05:00
(namespace_uri
(string) @text.uri @string.special)
2023-01-21 07:39:15 -05:00
(number) @number
(double) @float
(boolean) @boolean
; Typedefs
2023-01-28 15:47:47 -05:00
(typedef_identifier) @type.definition
2023-01-21 07:39:15 -05:00
2023-01-28 15:47:47 -05:00
; Punctuation
2023-01-21 07:39:15 -05:00
[
"*"
] @punctuation.special
["{" "}"] @punctuation.bracket
["(" ")"] @punctuation.bracket
["[" "]"] @punctuation.bracket
["<" ">"] @punctuation.bracket
2023-01-21 07:39:15 -05:00
[
"."
2023-01-21 07:39:15 -05:00
","
";"
":"
2023-01-21 07:39:15 -05:00
] @punctuation.delimiter
; Comments
(comment) @comment @spell
((comment) @comment.documentation
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
((comment) @comment.documentation
(#lua-match? @comment.documentation "^///[^/]"))
((comment) @comment.documentation
(#lua-match? @comment.documentation "^///$"))
((comment) @preproc
(#lua-match? @preproc "#!.*"))
; Errors
(ERROR) @error