aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--book/src/generated/lang-support.md1
-rw-r--r--languages.toml14
-rw-r--r--runtime/queries/vala/highlights.scm218
3 files changed, 233 insertions, 0 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index 1f0ae241..1df83913 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -79,6 +79,7 @@
| tsx | ✓ | | | `typescript-language-server` |
| twig | ✓ | | | |
| typescript | ✓ | | ✓ | `typescript-language-server` |
+| vala | ✓ | | | `vala-language-server` |
| vue | ✓ | | | `vls` |
| wgsl | ✓ | | | |
| yaml | ✓ | | ✓ | `yaml-language-server` |
diff --git a/languages.toml b/languages.toml
index d5a93f11..d77b3686 100644
--- a/languages.toml
+++ b/languages.toml
@@ -1235,3 +1235,17 @@ indent = { tab-width = 2, unit = " " }
[[grammar]]
name = "nu"
source = { git = "https://github.com/LhKipp/tree-sitter-nu", rev = "db4e990b78824c8abef3618e0f93b7fe1e8f4c0d" }
+
+[[language]]
+name = "vala"
+scope = "source.vala"
+injection-regex = "vala"
+file-types = ["vala", "vapi"]
+roots = []
+comment-token = "//"
+indent = { tab-width = 2, unit = " " }
+language-server = { command = "vala-language-server" }
+
+[[grammar]]
+name = "vala"
+source = { git = "https://github.com/vala-lang/tree-sitter-vala", rev = "c9eea93ba2ec4ec1485392db11945819779745b3" }
diff --git a/runtime/queries/vala/highlights.scm b/runtime/queries/vala/highlights.scm
new file mode 100644
index 00000000..685cda13
--- /dev/null
+++ b/runtime/queries/vala/highlights.scm
@@ -0,0 +1,218 @@
+; highlights.scm
+
+; highlight constants
+(
+ (member_access_expression (identifier) @constant)
+ (#match? @constant "^[A-Z][A-Z_0-9]*$")
+)
+
+(
+ (member_access_expression (member_access_expression) @namespace (identifier) @constant)
+ (#match? @constant "^[A-Z][A-Z_0-9]*$")
+)
+
+(comment) @comment
+
+(type (symbol (_)? @namespace (identifier) @type))
+
+; highlight creation methods in object creation expressions
+(
+ (object_creation_expression (type (symbol (symbol (symbol)? @namespace (identifier) @type) (identifier) @constructor)))
+ (#match? @constructor "^[a-z][a-z_0-9]*$")
+)
+
+(unqualified_type (symbol . (identifier) @type))
+(unqualified_type (symbol (symbol) @namespace (identifier) @type))
+
+(attribute) @variable.other.member
+(method_declaration (symbol (symbol) @type (identifier) @function))
+(method_declaration (symbol (identifier) @function))
+(local_function_declaration (identifier) @function)
+(destructor_declaration (identifier) @function)
+(creation_method_declaration (symbol (symbol (identifier) @type) (identifier) @constructor))
+(creation_method_declaration (symbol (identifier) @constructor))
+(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))
+(lambda_expression (identifier) @variable.parameter)
+(parameter (identifier) @variable.parameter)
+(property_declaration (symbol (identifier) @variable.other.member))
+(field_declaration (identifier) @variable)
+(identifier) @variable
+[
+ (this_access)
+ (base_access)
+ (value_access)
+] @variable.builtin
+(boolean) @constant.builtin.boolean
+(character) @constant.character
+(integer) @constant.numeric.integer
+(null) @constant.builtin
+(real) @constant.numeric.float
+(regex) @string.regexp
+(string) @string
+[
+ (escape_sequence)
+ (string_formatter)
+] @string.special
+(template_string) @string
+(template_string_expression) @string.special
+(verbatim_string) @string
+[
+ "var"
+ "void"
+] @type.builtin
+
+[
+ "abstract"
+ "async"
+ "break"
+ "case"
+ "catch"
+ "class"
+ "const"
+ "construct"
+ "continue"
+ "default"
+ "delegate"
+ "do"
+ "dynamic"
+ "else"
+ "enum"
+ "errordomain"
+ "extern"
+ "finally"
+ "for"
+ "foreach"
+ "get"
+ "if"
+ "inline"
+ "interface"
+ "internal"
+ "lock"
+ "namespace"
+ "new"
+ "out"
+ "override"
+ "owned"
+ "partial"
+ "private"
+ "protected"
+ "public"
+ "ref"
+ "set"
+ "signal"
+ "static"
+ "struct"
+ "switch"
+ "throw"
+ "throws"
+ "try"
+ "unowned"
+ "virtual"
+ "weak"
+ "while"
+ "with"
+] @keyword
+
+[
+ "and"
+ "as"
+ "delete"
+ "in"
+ "is"
+ "not"
+ "or"
+ "sizeof"
+ "typeof"
+] @keyword.operator
+
+"using" @namespace
+
+(symbol "global::" @namespace)
+
+(array_creation_expression "new" @keyword.operator)
+(object_creation_expression "new" @keyword.operator)
+(argument "out" @keyword.operator)
+(argument "ref" @keyword.operator)
+
+[
+ "continue"
+ "do"
+ "for"
+ "foreach"
+ "while"
+] @keyword.control.repeat
+
+[
+ "catch"
+ "finally"
+ "throw"
+ "throws"
+ "try"
+] @keyword.control.exception
+
+[
+ "return"
+ "yield"
+] @keyword.control.return
+
+[
+ "="
+ "=="
+ "+"
+ "+="
+ "-"
+ "-="
+ "++"
+ "--"
+ "|"
+ "|="
+ "&"
+ "&="
+ "^"
+ "^="
+ "/"
+ "/="
+ "*"
+ "*="
+ "%"
+ "%="
+ "<<"
+ "<<="
+ ">>"
+ ">>="
+ "."
+ "?."
+ "->"
+ "!"
+ "!="
+ "~"
+ "??"
+ "?"
+ ":"
+ "<"
+ "<="
+ ">"
+ ">="
+ "||"
+ "&&"
+ "=>"
+] @operator
+
+[
+ ","
+ ";"
+] @punctuation.delimiter
+
+[
+ "("
+ ")"
+ "{"
+ "}"
+ "["
+ "]"
+] @punctuation.bracket