aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/v
diff options
context:
space:
mode:
authorlydiandy2023-07-30 23:04:55 +0000
committerGitHub2023-07-30 23:04:55 +0000
commit57952c46a4f3bf75d0b9940c2c42399980416523 (patch)
tree47230d1bcd54ae06d75925317db07d2b4fd1067d /runtime/queries/v
parentd5571968faf498f2bf12e18835755377d22e13a4 (diff)
replace new lsp for vlang (#7760)
* fix vlang grammar fetch and build fail * update highlights.scm for v-analyzer * Update languages.toml Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Update runtime/queries/v/highlights.scm Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * update scm for new lsp * gen doc lang-support.md --------- Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
Diffstat (limited to 'runtime/queries/v')
-rw-r--r--runtime/queries/v/highlights.scm136
-rw-r--r--runtime/queries/v/indents.scm5
-rw-r--r--runtime/queries/v/textobjects.scm6
3 files changed, 90 insertions, 57 deletions
diff --git a/runtime/queries/v/highlights.scm b/runtime/queries/v/highlights.scm
index e014b77d..fbaf7088 100644
--- a/runtime/queries/v/highlights.scm
+++ b/runtime/queries/v/highlights.scm
@@ -1,83 +1,112 @@
+(comment) @comment
+
+(module_clause
+ (identifier) @namespace)
+
+(import_path
+ (import_name) @namespace)
+
+(import_alias
+ (import_name) @namespace)
+
+(enum_fetch
+ (reference_expression) @constant)
+
+(enum_field_definition
+ (identifier) @constant)
+
+(global_var_definition
+ (identifier) @constant)
+
+(compile_time_if_expression
+ condition: (reference_expression) @constant)
+
+(compile_time_if_expression
+ condition: (binary_expression
+ left: (reference_expression) @constant
+ right: (reference_expression) @constant))
+
+(compile_time_if_expression
+ condition: (binary_expression
+ left: (reference_expression) @constant
+ right: (unary_expression (reference_expression) @constant)))
+
+(label_reference) @label
+
(parameter_declaration
- name: (identifier) @variable.parameter)
+ name: (identifier) @variable.parameter)
+(receiver
+ name: (identifier) @variable.parameter)
(function_declaration
- name: (identifier) @function)
+ name: (identifier) @function)
(function_declaration
- receiver: (parameter_list)
- name: (identifier) @function.method)
+ receiver: (receiver)
+ name: (identifier) @function.method)
+(interface_method_definition
+ name: (identifier) @function.method)
(call_expression
- function: (identifier) @function)
-(call_expression
- function: (selector_expression
- field: (identifier) @function.method))
+ name: (selector_expression
+ field: (reference_expression) @function.method))
-(field_identifier) @variable.other.member
-(selector_expression
- operand: (identifier) @variable
- field: (identifier) @variable.other.member)
+(call_expression
+ name: (reference_expression) @function)
-(int_literal) @constant.numeric.integer
+(struct_declaration
+ name: (identifier) @type)
-(attribute_declaration) @attribute
-(comment) @comment
-[
- (c_string_literal)
- (raw_string_literal)
- (interpreted_string_literal)
- (string_interpolation)
- (rune_literal)
-] @string
+(enum_declaration
+ name: (identifier) @type)
-(escape_sequence) @constant.character.escape
+(interface_declaration
+ name: (identifier) @type)
-[
- (pointer_type)
- (array_type)
-] @type
+(type_declaration
+ name: (identifier) @type)
-(const_spec name: (identifier) @constant)
-(global_var_type_initializer name: (identifier) @constant)
-(global_var_spec name: (identifier) @constant)
-((identifier) @constant (#match? @constant "^[A-Z][A-Z\\d_]*$"))
+(struct_field_declaration
+ name: (identifier) @variable.other.member)
+(field_name) @variable.other.member
-[
- (generic_type)
- (type_identifier)
-] @constructor
+(selector_expression
+ field: (reference_expression) @variable.other.member)
-(builtin_type) @type.builtin
+(int_literal) @constant.numeric.integer
+(escape_sequence) @constant.character.escape
[
- (true)
- (false)
-] @constant.builtin.boolean
+ (c_string_literal)
+ (raw_string_literal)
+ (interpreted_string_literal)
+ (string_interpolation)
+ (rune_literal)
+] @string
+(string_interpolation
+ (braced_interpolation_opening) @punctuation.bracket
+ (interpolated_expression) @embedded
+ (braced_interpolation_closing) @punctuation.bracket)
-[
- (module_identifier)
- (import_path)
-] @namespace
+(attribute) @attribute
[
- (pseudo_comptime_identifier)
- (label_name)
-] @label
+ (type_reference_expression)
+ ] @type
[
- (identifier)
-] @variable
-
+ (true)
+ (false)
+] @constant.builtin.boolean
[
"pub"
"assert"
- "go"
"asm"
"defer"
"unsafe"
"sql"
+ (nil)
(none)
] @keyword
@@ -105,12 +134,17 @@
"lock"
"rlock"
"spawn"
+ "break"
+ "continue"
+ "go"
] @keyword.control
[
"if"
+ "$if"
"select"
"else"
+ "$else"
"match"
] @keyword.control.conditional
@@ -155,7 +189,7 @@
"]"
] @punctuation.bracket
-(array) @punctuation.bracket
+(array_creation) @punctuation.bracket
[
"++"
diff --git a/runtime/queries/v/indents.scm b/runtime/queries/v/indents.scm
index 5573d489..21dae30f 100644
--- a/runtime/queries/v/indents.scm
+++ b/runtime/queries/v/indents.scm
@@ -3,11 +3,10 @@
(function_declaration)
(if_expression)
(match_expression)
- (expression_case)
- (default_case)
(for_statement)
(unsafe_expression)
- (short_var_declaration)
+ (var_declaration)
+ (const_declaration)
] @indent
[
diff --git a/runtime/queries/v/textobjects.scm b/runtime/queries/v/textobjects.scm
index 40eb101f..5015af17 100644
--- a/runtime/queries/v/textobjects.scm
+++ b/runtime/queries/v/textobjects.scm
@@ -6,7 +6,7 @@
body: (block)? @test.inside) @test.around
(#match? @_name "^test"))
-(fn_literal
+(function_literal
body: (block)? @function.inside) @function.around
(parameter_list
@@ -17,9 +17,9 @@
((_) @parameter.inside) @parameter.around))
(struct_declaration
- (struct_field_declaration_list) @class.inside) @class.around
+ (struct_field_declaration) @class.inside) @class.around
-(struct_field_declaration_list
+(struct_field_declaration
((_) @parameter.inside) @parameter.around)
(comment) @comment.inside