diff options
Diffstat (limited to 'runtime/queries/thrift')
| -rw-r--r-- | runtime/queries/thrift/folds.scm | 12 | ||||
| -rw-r--r-- | runtime/queries/thrift/highlights.scm | 237 | ||||
| -rw-r--r-- | runtime/queries/thrift/indents.scm | 23 | ||||
| -rw-r--r-- | runtime/queries/thrift/injections.scm | 2 | ||||
| -rw-r--r-- | runtime/queries/thrift/locals.scm | 70 |
5 files changed, 344 insertions, 0 deletions
diff --git a/runtime/queries/thrift/folds.scm b/runtime/queries/thrift/folds.scm new file mode 100644 index 000000000..62880f98c --- /dev/null +++ b/runtime/queries/thrift/folds.scm @@ -0,0 +1,12 @@ +[ + (annotation_definition) + (enum_definition) + (exception_definition) + (function_definition) + (senum_definition) + (service_definition) + (struct_definition) + (union_definition) + (comment) + (include_statement)+ +] @fold diff --git a/runtime/queries/thrift/highlights.scm b/runtime/queries/thrift/highlights.scm new file mode 100644 index 000000000..96136d7b5 --- /dev/null +++ b/runtime/queries/thrift/highlights.scm @@ -0,0 +1,237 @@ +; Variables +((identifier) @variable + (#set! priority 95)) + +; Includes +[ + "include" + "cpp_include" +] @keyword.import + +; Function +(function_definition + (identifier) @function) + +; Fields +(field + (identifier) @property) + +; Parameters +(function_definition + (parameters + (parameter + (identifier) @variable.parameter))) + +(throws + (parameters + (parameter + (identifier) @variable.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 + type: (identifier) @type) + +(enum_definition + "{" + (identifier) @constant) + +; Builtin Types +[ + (primitive) + "list" + "map" + "set" + "sink" + "stream" + "void" +] @type.builtin + +; Namespace +(namespace_declaration + (namespace_scope) @string.special) + +(namespace_declaration + (namespace_scope) + [ + type: (namespace) @module + (_ + (identifier) @module) + ]) + +; Attributes +(annotation_definition + (annotation_identifier + (identifier) @attribute)) + +(fb_annotation_definition + "@" @attribute + (annotation_identifier + (identifier) @attribute) + (identifier)? @attribute) + +(namespace_uri + (string) @attribute) + +; Operators +[ + "=" + "&" +] @operator + +; Exceptions +"throws" @keyword.exception + +; Keywords +[ + "exception" + "extends" + "typedef" + "uri" +] @keyword + +[ + "enum" + "struct" + "union" + "senum" + "interaction" + "namespace" + "service" +] @keyword.type + +; Deprecated Keywords +[ + "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 + +; Extended Keywords +[ + "package" + "performs" +] @keyword + +[ + "async" + "oneway" +] @keyword.coroutine + +; Qualifiers +[ + "client" + "const" + "idempotent" + "optional" + "permanent" + "readonly" + "required" + "safe" + "server" + "stateful" + "transient" +] @keyword.modifier + +; Literals +(string) @string + +(escape_sequence) @string.escape + +(namespace_uri + (string) @string.special.url) + +(number) @number + +(double) @number.float + +(boolean) @boolean + +; Typedefs +(typedef_identifier) @type.definition + +; Punctuation +"*" @punctuation.special + +[ + "{" + "}" + "(" + ")" + "[" + "]" + "<" + ">" +] @punctuation.bracket + +[ + "." + "," + ";" + ":" +] @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) @keyword.directive @nospell + (#lua-match? @keyword.directive "#!.*")) diff --git a/runtime/queries/thrift/indents.scm b/runtime/queries/thrift/indents.scm new file mode 100644 index 000000000..db49c0712 --- /dev/null +++ b/runtime/queries/thrift/indents.scm @@ -0,0 +1,23 @@ +(definition) @indent.begin + +((parameters + (parameter)) @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) + +"}" @indent.end + +[ + "{" + "}" +] @indent.branch + +[ + "(" + ")" +] @indent.branch + +[ + (ERROR) + (comment) +] @indent.auto diff --git a/runtime/queries/thrift/injections.scm b/runtime/queries/thrift/injections.scm new file mode 100644 index 000000000..2f0e58eb6 --- /dev/null +++ b/runtime/queries/thrift/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/thrift/locals.scm b/runtime/queries/thrift/locals.scm new file mode 100644 index 000000000..49f25bdde --- /dev/null +++ b/runtime/queries/thrift/locals.scm @@ -0,0 +1,70 @@ +; Scopes +[ + (document) + (definition) +] @local.scope + +; References +(identifier) @local.reference + +; Definitions +(annotation_identifier) @local.definition + +(const_definition + (identifier) @local.definition.constant) + +(enum_definition + "enum" + . + (identifier) @local.definition.enum + "{" + (identifier) @local.definition.constant + "}") + +(senum_definition + "senum" + . + (identifier) @local.definition.enum) + +(field + (identifier) @local.definition.field) + +(function_definition + (identifier) @local.definition.function) + +(namespace_declaration + "namespace" + (namespace_scope) + . + (_) @local.definition.namespace + (namespace_uri)?) + +(parameter + (identifier) @local.definition.parameter) + +(struct_definition + "struct" + . + (identifier) @local.definition.type) + +(union_definition + "union" + . + (identifier) @local.definition.type) + +(exception_definition + "exception" + . + (identifier) @local.definition.type) + +(service_definition + "service" + . + (identifier) @local.definition.type) + +(interaction_definition + "interaction" + . + (identifier) @local.definition.type) + +(typedef_identifier) @local.definition.type |
