Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace new lsp for vlang #7760

Merged
merged 6 commits into from
Jul 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update highlights.scm for v-analyzer
  • Loading branch information
lydiandy committed Jul 27, 2023
commit 0440c24c75788f093f6691a77d605f83d0b8069c
136 changes: 85 additions & 51 deletions runtime/queries/v/highlights.scm
Original file line number Diff line number Diff line change
@@ -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) @none
lydiandy marked this conversation as resolved.
Show resolved Hide resolved
(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

Expand Down Expand Up @@ -105,12 +134,17 @@
"lock"
"rlock"
"spawn"
"break"
"continue"
"go"
] @keyword.control

[
"if"
"$if"
"select"
"else"
"$else"
"match"
] @keyword.control.conditional

Expand Down Expand Up @@ -155,7 +189,7 @@
"]"
] @punctuation.bracket

(array) @punctuation.bracket
(array_creation) @punctuation.bracket

[
"++"
Expand Down