feat(thrift): improve queries

This commit is contained in:
Amaan Qureshi 2023-02-06 13:34:05 -05:00 committed by Stephan Seitz
parent 17d7cf6f4b
commit 93386fc725
5 changed files with 57 additions and 2 deletions

View file

@ -1323,6 +1323,7 @@ list.thrift = {
install_info = {
url = "https://github.com/duskmoon314/tree-sitter-thrift",
files = { "src/parser.c" },
branch = "main",
},
maintainers = { "@amaanq", "@duskmoon314" },
}

View file

@ -1,11 +1,12 @@
[
(annotation)
(enum)
(exception)
(function)
(senum)
(service)
(struct)
(union)
(function_parameters)
(exception_parameters)
(comment)
] @fold

View file

@ -0,0 +1,20 @@
(definition) @indent
; (function (function_identifier) @aligned_indent)
((function_parameters (function_parameter)) @aligned_indent
(#set! "delimiter" "()"))
((exception_parameters (exception_parameter)) @aligned_indent
(#set! "delimiter" "()"))
"}" @indent_end
[ "{" "}" ] @branch
[ "(" ")" ] @branch
[
(ERROR)
(comment)
] @auto

View file

@ -0,0 +1 @@
(comment) @comment

32
queries/thrift/locals.scm Normal file
View file

@ -0,0 +1,32 @@
(document) @scope
(definition) @scope
[
(identifier)
(field_type)
(custom_type)
] @reference
(const_value (const_identifier) @reference)
(annotation_identifier) @definition
(const (const_identifier) @definition.constant)
(enum_member) @definition.constant
(enum_identifier) @definition.enum
(field_identifier) @definition.field
(function_identifier) @definition.function
(namespace_definition) @definition.namespace
[
(param_identifier)
(exception_param_identifier)
] @definition.parameter
[
(type_identifier)
(exception_identifier)
] @definition.type