aboutsummaryrefslogtreecommitdiffstats
path: root/queries/vala
diff options
context:
space:
mode:
authorPham Huy Hoang <hoangtun0810@gmail.com>2024-01-06 15:05:50 +0900
committerChristian Clason <c.clason@uni-graz.at>2024-01-19 16:58:37 +0100
commit57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9 (patch)
tree70bf645539882b88e6fa129cefd30986b89bbac3 /queries/vala
parentci: add query lint job (diff)
downloadnvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.gz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.bz2
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.lz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.xz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.zst
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.zip
chore: query formatting
Diffstat (limited to 'queries/vala')
-rw-r--r--queries/vala/folds.scm1
-rw-r--r--queries/vala/highlights.scm410
2 files changed, 251 insertions, 160 deletions
diff --git a/queries/vala/folds.scm b/queries/vala/folds.scm
index 86b731eea..a334e609c 100644
--- a/queries/vala/folds.scm
+++ b/queries/vala/folds.scm
@@ -9,4 +9,3 @@
(block)
(class_member)
] @fold
-
diff --git a/queries/vala/highlights.scm b/queries/vala/highlights.scm
index 3250adcb4..31c02ad1b 100644
--- a/queries/vala/highlights.scm
+++ b/queries/vala/highlights.scm
@@ -1,118 +1,200 @@
; highlights.scm
-
; highlight comments and symbols
(comment) @comment @spell
+
((comment) @comment.documentation
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
+
(symbol) @string.special.symbol
-(member_access_expression (_) (identifier) @string.special.symbol)
+
+(member_access_expression
+ (_)
+ (identifier) @string.special.symbol)
; highlight constants
-(
- (member_access_expression (identifier) @constant)
- (#lua-match? @constant "^[%u][%u%d_]*$")
-)
+((member_access_expression
+ (identifier) @constant)
+ (#lua-match? @constant "^[%u][%u%d_]*$"))
-(
- (member_access_expression (member_access_expression) @keyword.import (identifier) @constant)
- (#lua-match? @constant "^[%u][%u%d_]*$")
-)
+((member_access_expression
+ (member_access_expression) @keyword.import
+ (identifier) @constant)
+ (#lua-match? @constant "^[%u][%u%d_]*$"))
; highlight types and probable types
-(type (symbol (_)? @module (identifier) @type))
-(
- (member_access_expression . (identifier) @type)
- (#match? @type "^[A-Z][A-Za-z_0-9]{2,}$")
-)
+(type
+ (symbol
+ (_)? @module
+ (identifier) @type))
+
+((member_access_expression
+ .
+ (identifier) @type)
+ (#match? @type "^[A-Z][A-Za-z_0-9]{2,}$"))
; highlight creation methods in object creation expressions
-(
- (object_creation_expression (type (symbol (symbol (symbol)? @keyword.import (identifier) @type) (identifier) @constructor)))
- (#lua-match? @constructor "^[%l][%l%d_]*$")
-)
+((object_creation_expression
+ (type
+ (symbol
+ (symbol
+ (symbol)? @keyword.import
+ (identifier) @type)
+ (identifier) @constructor)))
+ (#lua-match? @constructor "^[%l][%l%d_]*$"))
+
+(unqualified_type
+ (symbol
+ .
+ (identifier) @type))
-(unqualified_type (symbol . (identifier) @type))
-(unqualified_type (symbol (symbol) @module (identifier) @type))
+(unqualified_type
+ (symbol
+ (symbol) @module
+ (identifier) @type))
(attribute) @attribute
-(namespace_declaration (symbol) @module)
-(method_declaration (symbol (symbol) @type (identifier) @function))
-(method_declaration (symbol (identifier) @function))
-(local_declaration (assignment (identifier) @variable))
-(local_function_declaration (identifier) @function)
-(destructor_declaration (identifier) @function)
-(creation_method_declaration (symbol (symbol) @type (identifier) @constructor))
-(creation_method_declaration (symbol (identifier) @constructor))
-(constructor_declaration (_)? "construct" @keyword.function)
-(enum_declaration (symbol) @type)
-(enum_value (identifier) @constant)
-(errordomain_declaration (symbol) @type)
-(errorcode (identifier) @constant)
-(constant_declaration (identifier) @constant)
-(method_call_expression (member_access_expression (identifier) @function))
+
+(namespace_declaration
+ (symbol) @module)
+
+(method_declaration
+ (symbol
+ (symbol) @type
+ (identifier) @function))
+
+(method_declaration
+ (symbol
+ (identifier) @function))
+
+(local_declaration
+ (assignment
+ (identifier) @variable))
+
+(local_function_declaration
+ (identifier) @function)
+
+(destructor_declaration
+ (identifier) @function)
+
+(creation_method_declaration
+ (symbol
+ (symbol) @type
+ (identifier) @constructor))
+
+(creation_method_declaration
+ (symbol
+ (identifier) @constructor))
+
+(constructor_declaration
+ (_)?
+ "construct" @keyword.function)
+
+(enum_declaration
+ (symbol) @type)
+
+(enum_value
+ (identifier) @constant)
+
+(errordomain_declaration
+ (symbol) @type)
+
+(errorcode
+ (identifier) @constant)
+
+(constant_declaration
+ (identifier) @constant)
+
+(method_call_expression
+ (member_access_expression
+ (identifier) @function))
+
; highlight macros
-(
- (method_call_expression (member_access_expression (identifier) @function.macro))
- (#match? @function.macro "^assert[A-Za-z_0-9]*|error|info|debug|print|warning|warning_once$")
-)
-(lambda_expression (identifier) @variable.parameter)
-(parameter (identifier) @variable.parameter)
-(property_declaration (symbol (identifier) @property))
-(field_declaration (identifier) @variable.member)
+((method_call_expression
+ (member_access_expression
+ (identifier) @function.macro))
+ (#match? @function.macro "^assert[A-Za-z_0-9]*|error|info|debug|print|warning|warning_once$"))
+
+(lambda_expression
+ (identifier) @variable.parameter)
+
+(parameter
+ (identifier) @variable.parameter)
+
+(property_declaration
+ (symbol
+ (identifier) @property))
+
+(field_declaration
+ (identifier) @variable.member)
+
[
- (this_access)
- (base_access)
- (value_access)
+ (this_access)
+ (base_access)
+ (value_access)
] @constant.builtin
+
(boolean) @boolean
+
(character) @character
+
(escape_sequence) @string.escape
+
(integer) @number
+
(null) @constant.builtin
+
(real) @number.float
+
(regex) @string.regexp
+
(string) @string
+
(string_formatter) @string.special
+
(template_string) @string
+
(template_string_expression) @string.special
+
(verbatim_string) @string
+
[
- "var"
- "void"
+ "var"
+ "void"
] @type.builtin
(if_directive
- expression: (_) @keyword.directive
-) @keyword
+ expression: (_) @keyword.directive) @keyword
+
(elif_directive
- expression: (_) @keyword.directive
-) @keyword
+ expression: (_) @keyword.directive) @keyword
+
(else_directive) @keyword
+
(endif_directive) @keyword
[
- "abstract"
- "class"
- "construct"
- "continue"
- "default"
- "delegate"
- "enum"
- "errordomain"
- "get"
- "inline"
- "interface"
- "namespace"
- "new"
- "out"
- "override"
- "partial"
- "ref"
- "set"
- "signal"
- "struct"
- "virtual"
- "with"
+ "abstract"
+ "class"
+ "construct"
+ "continue"
+ "default"
+ "delegate"
+ "enum"
+ "errordomain"
+ "get"
+ "inline"
+ "interface"
+ "namespace"
+ "new"
+ "out"
+ "override"
+ "partial"
+ "ref"
+ "set"
+ "signal"
+ "struct"
+ "virtual"
+ "with"
] @keyword
[
@@ -121,54 +203,66 @@
] @keyword.coroutine
[
- "const"
- "dynamic"
- "owned"
- "weak"
- "unowned"
+ "const"
+ "dynamic"
+ "owned"
+ "weak"
+ "unowned"
] @type.qualifier
[
- "case"
- "else"
- "if"
- "switch"
+ "case"
+ "else"
+ "if"
+ "switch"
] @keyword.conditional
; specially highlight break statements in switch sections
-(switch_section (break_statement "break" @keyword.conditional))
+(switch_section
+ (break_statement
+ "break" @keyword.conditional))
[
- "extern"
- "internal"
- "private"
- "protected"
- "public"
- "static"
+ "extern"
+ "internal"
+ "private"
+ "protected"
+ "public"
+ "static"
] @keyword.storage
[
- "and"
- "as"
- "delete"
- "in"
- "is"
- "lock"
- "not"
- "or"
- "sizeof"
- "typeof"
+ "and"
+ "as"
+ "delete"
+ "in"
+ "is"
+ "lock"
+ "not"
+ "or"
+ "sizeof"
+ "typeof"
] @keyword.operator
"using" @keyword.import
-(using_directive (symbol) @module)
-(symbol "global::" @module)
+(using_directive
+ (symbol) @module)
+
+(symbol
+ "global::" @module)
+
+(array_creation_expression
+ "new" @keyword.operator)
-(array_creation_expression "new" @keyword.operator)
-(object_creation_expression "new" @keyword.operator)
-(argument "out" @keyword.operator)
-(argument "ref" @keyword.operator)
+(object_creation_expression
+ "new" @keyword.operator)
+
+(argument
+ "out" @keyword.operator)
+
+(argument
+ "ref" @keyword.operator)
[
"break"
@@ -187,64 +281,62 @@
"try"
] @keyword.exception
-[
- "return"
-] @keyword.return
+"return" @keyword.return
[
- "="
- "=="
- "+"
- "+="
- "-"
- "-="
- "++"
- "--"
- "|"
- "|="
- "&"
- "&="
- "^"
- "^="
- "/"
- "/="
- "*"
- "*="
- "%"
- "%="
- "<<"
- "<<="
- ">>"
- ">>="
- "."
- "?."
- "->"
- "!"
- "!="
- "~"
- "??"
- "?"
- ":"
- "<"
- "<="
- ">"
- ">="
- "||"
- "&&"
- "=>"
+ "="
+ "=="
+ "+"
+ "+="
+ "-"
+ "-="
+ "++"
+ "--"
+ "|"
+ "|="
+ "&"
+ "&="
+ "^"
+ "^="
+ "/"
+ "/="
+ "*"
+ "*="
+ "%"
+ "%="
+ "<<"
+ "<<="
+ ">>"
+ ">>="
+ "."
+ "?."
+ "->"
+ "!"
+ "!="
+ "~"
+ "??"
+ "?"
+ ":"
+ "<"
+ "<="
+ ">"
+ ">="
+ "||"
+ "&&"
+ "=>"
] @operator
[
- ","
- ";"
+ ","
+ ";"
] @punctuation.delimiter
[
- "$("
- "("
- ")"
- "{"
- "}"
- "["
- "]"
+ "$("
+ "("
+ ")"
+ "{"
+ "}"
+ "["
+ "]"
] @punctuation.bracket