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>
This commit is contained in:
lydiandy 2023-07-31 07:04:55 +08:00 committed by GitHub
parent d5571968fa
commit 57952c46a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 94 additions and 61 deletions

View File

@ -156,7 +156,7 @@
| typescript | ✓ | ✓ | ✓ | `typescript-language-server` | | typescript | ✓ | ✓ | ✓ | `typescript-language-server` |
| ungrammar | ✓ | | | | | ungrammar | ✓ | | | |
| uxntal | ✓ | | | | | uxntal | ✓ | | | |
| v | ✓ | ✓ | ✓ | `v` | | v | ✓ | ✓ | ✓ | `v-analyzer` |
| vala | ✓ | | | `vala-language-server` | | vala | ✓ | | | `vala-language-server` |
| verilog | ✓ | ✓ | | `svlangserver` | | verilog | ✓ | ✓ | | `svlangserver` |
| vhdl | ✓ | | | `vhdl_ls` | | vhdl | ✓ | | | `vhdl_ls` |

View File

@ -70,7 +70,7 @@ terraform-ls = { command = "terraform-ls", args = ["serve"] }
texlab = { command = "texlab" } texlab = { command = "texlab" }
vala-language-server = { command = "vala-language-server" } vala-language-server = { command = "vala-language-server" }
vhdl_ls = { command = "vhdl_ls", args = [] } vhdl_ls = { command = "vhdl_ls", args = [] }
vlang-language-server = { command = "v", args = ["ls"] } vlang-language-server = { command = "v-analyzer" }
vscode-css-language-server = { command = "vscode-css-language-server", args = ["--stdio"], config = { "provideFormatter" = true }} vscode-css-language-server = { command = "vscode-css-language-server", args = ["--stdio"], config = { "provideFormatter" = true }}
vscode-html-language-server = { command = "vscode-html-language-server", args = ["--stdio"], config = { provideFormatter = true } } vscode-html-language-server = { command = "vscode-html-language-server", args = ["--stdio"], config = { provideFormatter = true } }
vscode-json-language-server = { command = "vscode-json-language-server", args = ["--stdio"], config = { provideFormatter = true } } vscode-json-language-server = { command = "vscode-json-language-server", args = ["--stdio"], config = { provideFormatter = true } }
@ -1826,7 +1826,7 @@ indent = { tab-width = 4, unit = "\t" }
[[grammar]] [[grammar]]
name = "v" name = "v"
source = { git = "https://github.com/vlang/vls", subpath = "tree_sitter_v", rev = "66cf9d3086fb5ecc827cb32c64c5d812ab17d2c6" } source = {git = "https://github.com/v-analyzer/v-analyzer", subpath = "tree_sitter_v", rev = "e14fdf6e661b10edccc744102e4ccf0b187aa8ad"}
[[language]] [[language]]
name = "verilog" name = "verilog"

View File

@ -1,26 +1,80 @@
(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 (parameter_declaration
name: (identifier) @variable.parameter) name: (identifier) @variable.parameter)
(receiver
name: (identifier) @variable.parameter)
(function_declaration (function_declaration
name: (identifier) @function) name: (identifier) @function)
(function_declaration (function_declaration
receiver: (parameter_list) receiver: (receiver)
name: (identifier) @function.method)
(interface_method_definition
name: (identifier) @function.method) name: (identifier) @function.method)
(call_expression (call_expression
function: (identifier) @function) name: (selector_expression
(call_expression field: (reference_expression) @function.method))
function: (selector_expression
field: (identifier) @function.method)) (call_expression
name: (reference_expression) @function)
(struct_declaration
name: (identifier) @type)
(enum_declaration
name: (identifier) @type)
(interface_declaration
name: (identifier) @type)
(type_declaration
name: (identifier) @type)
(struct_field_declaration
name: (identifier) @variable.other.member)
(field_name) @variable.other.member
(field_identifier) @variable.other.member
(selector_expression (selector_expression
operand: (identifier) @variable field: (reference_expression) @variable.other.member)
field: (identifier) @variable.other.member)
(int_literal) @constant.numeric.integer (int_literal) @constant.numeric.integer
(escape_sequence) @constant.character.escape
(attribute_declaration) @attribute
(comment) @comment
[ [
(c_string_literal) (c_string_literal)
(raw_string_literal) (raw_string_literal)
@ -29,55 +83,30 @@
(rune_literal) (rune_literal)
] @string ] @string
(escape_sequence) @constant.character.escape (string_interpolation
(braced_interpolation_opening) @punctuation.bracket
(interpolated_expression) @embedded
(braced_interpolation_closing) @punctuation.bracket)
(attribute) @attribute
[ [
(pointer_type) (type_reference_expression)
(array_type) ] @type
] @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_]*$"))
[
(generic_type)
(type_identifier)
] @constructor
(builtin_type) @type.builtin
[ [
(true) (true)
(false) (false)
] @constant.builtin.boolean ] @constant.builtin.boolean
[
(module_identifier)
(import_path)
] @namespace
[
(pseudo_comptime_identifier)
(label_name)
] @label
[
(identifier)
] @variable
[ [
"pub" "pub"
"assert" "assert"
"go"
"asm" "asm"
"defer" "defer"
"unsafe" "unsafe"
"sql" "sql"
(nil)
(none) (none)
] @keyword ] @keyword
@ -105,12 +134,17 @@
"lock" "lock"
"rlock" "rlock"
"spawn" "spawn"
"break"
"continue"
"go"
] @keyword.control ] @keyword.control
[ [
"if" "if"
"$if"
"select" "select"
"else" "else"
"$else"
"match" "match"
] @keyword.control.conditional ] @keyword.control.conditional
@ -155,7 +189,7 @@
"]" "]"
] @punctuation.bracket ] @punctuation.bracket
(array) @punctuation.bracket (array_creation) @punctuation.bracket
[ [
"++" "++"

View File

@ -3,11 +3,10 @@
(function_declaration) (function_declaration)
(if_expression) (if_expression)
(match_expression) (match_expression)
(expression_case)
(default_case)
(for_statement) (for_statement)
(unsafe_expression) (unsafe_expression)
(short_var_declaration) (var_declaration)
(const_declaration)
] @indent ] @indent
[ [

View File

@ -6,7 +6,7 @@
body: (block)? @test.inside) @test.around body: (block)? @test.inside) @test.around
(#match? @_name "^test")) (#match? @_name "^test"))
(fn_literal (function_literal
body: (block)? @function.inside) @function.around body: (block)? @function.inside) @function.around
(parameter_list (parameter_list
@ -17,9 +17,9 @@
((_) @parameter.inside) @parameter.around)) ((_) @parameter.inside) @parameter.around))
(struct_declaration (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) ((_) @parameter.inside) @parameter.around)
(comment) @comment.inside (comment) @comment.inside