feat(lsp): add vala language support (#2243)

This commit is contained in:
ttys3 2022-04-25 00:21:07 +08:00 committed by GitHub
parent ea02b46c5d
commit a8cb46680d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 233 additions and 0 deletions

View file

@ -79,6 +79,7 @@
| tsx | ✓ | | | `typescript-language-server` |
| twig | ✓ | | | |
| typescript | ✓ | | ✓ | `typescript-language-server` |
| vala | ✓ | | | `vala-language-server` |
| vue | ✓ | | | `vls` |
| wgsl | ✓ | | | |
| yaml | ✓ | | ✓ | `yaml-language-server` |

View file

@ -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" }

View file

@ -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