refactor(v)!: update upstream repository

This commit is contained in:
Amaan Qureshi 2023-07-04 04:12:21 -04:00 committed by Christian Clason
parent c9bb5a5a7f
commit 46b1ad3de2
6 changed files with 230 additions and 178 deletions

View file

@ -543,7 +543,7 @@
"revision": "14e47600afef0affffcbfbe1543381b1ac8fbc5c" "revision": "14e47600afef0affffcbfbe1543381b1ac8fbc5c"
}, },
"v": { "v": {
"revision": "f1b3a99285a58c6f5fe8add47877cde664b75a60" "revision": "e14fdf6e661b10edccc744102e4ccf0b187aa8ad"
}, },
"vala": { "vala": {
"revision": "8f690bfa639f2b83d1fb938ed3dd98a7ba453e8b" "revision": "8f690bfa639f2b83d1fb938ed3dd98a7ba453e8b"

View file

@ -1600,12 +1600,12 @@ list.uxntal = {
list.v = { list.v = {
install_info = { install_info = {
url = "https://github.com/vlang/vls", url = "https://github.com/v-analyzer/v-analyzer",
files = { "src/parser.c", "src/scanner.c" }, files = { "src/parser.c", "src/scanner.c" },
location = "tree_sitter_v", location = "tree_sitter_v",
}, },
filetype = "vlang", filetype = "vlang",
maintainers = { "@kkharji" }, maintainers = { "@kkharji", "@amaanq" },
} }
list.vala = { list.vala = {

View file

@ -1,196 +1,174 @@
;; reference https://github.com/vlang/vls ; Includes
;; rev: c3e9874fa6c3b38beaa50d53aff4967403e251a4
;; Identifiers -------------------
(import_path) @namespace
(module_identifier) @variable.builtin
(identifier) @variable
(interpreted_string_literal) @string
(string_interpolation) @none
; TODO: Have different highlight to make then standout + highlight }{$ as special
; ((string_interpolation
; (identifier) @constant
; "$" @punctuation.special
; "${" @punctuation.special
; "}" @punctuation.special))
[(type_identifier) (array_type) (pointer_type)] @type
(field_identifier) @property
(builtin_type) @type.builtin
(parameter_declaration
name: (identifier) @parameter)
(const_spec
name: (identifier) @constant)
((((selector_expression field: (identifier) @property)) @_parent
(#not-has-parent? @_parent call_expression special_call_expression)))
((identifier) @variable.builtin
(#any-of? @variable.builtin "err" "macos" "linux" "windows"))
(attribute_declaration) @attribute
;; C: TODO: fixme make `C`.exten highlighted as variable.builtin
; ((binded_identifier) @content
; (#offset! @content 0 3 0 -1)
; (#match? @content "^C$"))
;; Function calls ----------------
(call_expression
function: (identifier) @function.call)
(((_
function: (selector_expression field: (identifier) @function.call)
arguments: (_) @_args)
(#not-has-type? @_args arguments_list)))
((call_expression
function: (binded_identifier name: (identifier) @function)
@function.call))
;; Function definitions ---------
(function_declaration
name: (identifier) @function)
(function_declaration
receiver: (parameter_list)
name: (identifier) @method)
((function_declaration
(binded_identifier name: (identifier) @function)
@function))
;; Keywords
[ [
"import" "import"
"module" "module"
] @include ] @include
; Keywords
[
"asm"
"assert"
"const"
"defer"
"enum"
"goto"
"interface"
"struct"
"sql"
"type"
"union"
"unsafe"
] @keyword
[
"as"
"in"
"!in"
"or"
"is"
"!is"
] @keyword.operator
[ [
"match" "match"
"if" "if"
"$if" "$if"
"else" "else"
"$else" "$else"
"select"
] @conditional ] @conditional
[ [
"for" @repeat "for"
"$for" "$for"
"continue"
"break"
] @repeat ] @repeat
[
"as"
"in"
"!in"
"or"
"is"
"!is"
] @keyword.operator
[
"asm"
"assert"
"const"
"defer"
"enum"
"go"
"goto"
"interface"
"lock"
"mut"
"pub"
"rlock"
"struct"
"type"
"unsafe"
]
;; Either not supported or will be dropped
;"atomic"
;"break"
; "continue"
;"shared"
;"static"
;"union"
@keyword
"fn" @keyword.function "fn" @keyword.function
"return" @keyword.return "return" @keyword.return
; "import" @include ;; note: comment out b/c of import_path @namespace [
"__global"
"shared"
"static"
"const"
] @storageclass
[
"pub"
"mut"
] @type.qualifier
[
"go"
"spawn"
"lock"
"rlock"
] @keyword.coroutine
; Variables
(identifier) @variable
; Namespace
(module_clause
(identifier) @namespace)
(import_path
(import_name) @namespace)
(import_alias
(import_name) @namespace)
; Literals
[ (true) (false) ] @boolean [ (true) (false) ] @boolean
(interpreted_string_literal) @string
(string_interpolation) @none
;; Conditionals ---------------- ; Types
[ "else" "if"] @conditional
;; Operators ---------------- (struct_declaration
[ "." "," ":" ";"] @punctuation.delimiter name: (identifier) @type)
[ "(" ")" "{" "}" "[" "]"] @punctuation.bracket (enum_declaration
name: (identifier) @type)
(array) @punctuation.bracket (interface_declaration
name: (identifier) @type)
[ (type_declaration
"++" name: (identifier) @type)
"--"
"+" (type_reference_expression (identifier) @type)
"-"
"*"
"/"
"%"
"~" ; Labels
"&"
"|"
"^"
"!" (label_reference) @label
"&&"
"||"
"!="
"<<" ; Fields
">>"
"<" (selector_expression field: (reference_expression (identifier) @field))
">"
"<="
">="
"+=" (field_name) @field
"-="
"*="
"/="
"&="
"|="
"^="
"<<="
">>="
"=" (struct_field_declaration
":=" name: (identifier) @field)
"=="
"?" ; Parameters
"<-"
"$" (parameter_declaration
".." name: (identifier) @parameter)
"..."]
@operator (receiver
name: (identifier) @parameter)
; Constants
((identifier) @constant
(#has-ancestor? @constant compile_time_if_expression))
(enum_fetch
(reference_expression) @constant)
(enum_field_definition
(identifier) @constant)
(const_definition
name: (identifier) @constant)
((identifier) @variable.builtin
(#any-of? @variable.builtin "err" "macos" "linux" "windows"))
; Attributes
(attribute) @attribute
; Functions
(function_declaration
name: (identifier) @function)
(function_declaration
receiver: (receiver)
name: (identifier) @method)
(call_expression
name: (selector_expression
field: (reference_expression) @method.call))
(call_expression
name: (reference_expression) @function.call)
;; Builtin Functions, maybe redundant with (builtin_type)
((identifier) @function.builtin ((identifier) @function.builtin
(#any-of? @function.builtin (#any-of? @function.builtin
"eprint" "eprint"
"eprintln" "eprintln"
"error" "error"
@ -389,25 +367,101 @@
"vstrlen_char" "vstrlen_char"
"winapi_lasterr_str")) "winapi_lasterr_str"))
; Operators
;; Literals [
"++"
"--"
"+"
"-"
"*"
"/"
"%"
"~"
"&"
"|"
"^"
"!"
"&&"
"||"
"!="
"<<"
">>"
"<"
">"
"<="
">="
"+="
"-="
"*="
"/="
"&="
"|="
"^="
"<<="
">>="
"="
":="
"=="
"?"
"<-"
"$"
".."
"..."
] @operator
; Punctuation
[ "." "," ":" ";" ] @punctuation.delimiter
[ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket
; Literals
(int_literal) @number (int_literal) @number
(rune_literal) @string (float_literal) @float
(raw_string_literal) @string [
(c_string_literal)
(raw_string_literal)
(interpreted_string_literal)
(string_interpolation)
(rune_literal)
] @string
(string_interpolation
(braced_interpolation_opening) @punctuation.bracket
(interpolated_expression) @none
(braced_interpolation_closing) @punctuation.bracket)
(escape_sequence) @string.escape (escape_sequence) @string.escape
(float_literal) @float [
(true)
(false)
] @boolean
[(true) (false)] @boolean (nil) @constant.builtin
(ERROR) @error (none) @variable.builtin
; Comments
(comment) @comment @spell (comment) @comment @spell
(_ (_
(comment)+ @comment.documentation (comment)+ @comment.documentation
[(function_declaration) (type_declaration) (const_spec) (enum_declaration)]) [(function_declaration) (type_declaration) (enum_declaration)])
; Errors
(ERROR) @error

View file

@ -1,10 +1,9 @@
[(import_declaration) [(import_declaration)
(const_declaration) (const_declaration)
(type_declaration) (type_declaration)
(literal_value)
(type_initializer) (type_initializer)
(block) (block)
(map) (map_init_expression)
(call_expression) (call_expression)
(parameter_list)] (parameter_list)]
@indent.begin @indent.begin

View file

@ -6,8 +6,8 @@
;; regex for the methods defined in `re` module ;; regex for the methods defined in `re` module
((call_expression ((call_expression
function: (selector_expression name: (selector_expression
field: (identifier) @_re) field: (reference_expression (identifier) @_re))
arguments: (argument_list arguments: (argument_list
(raw_string_literal) @regex (#offset! @regex 0 2 0 -1))) (argument (literal (raw_string_literal) @regex (#offset! @regex 0 2 0 -1)))))
(#any-of? @_re "regex_base" "regex_opt" "compile_opt")) (#any-of? @_re "regex_base" "regex_opt" "compile_opt"))

View file

@ -1,25 +1,24 @@
((function_declaration ((function_declaration
name: (identifier) @definition.function)) ;@function name: (identifier) @definition.function)) ;@function
(short_var_declaration (var_declaration
left: (expression_list var_list: (expression_list
(identifier) @definition.var)) (reference_expression
(identifier) @definition.var)))
((function_declaration ((function_declaration
name: (binded_identifier name: (identifier) @definition.function))
name: (identifier) @definition.function)))
(const_declaration (const_spec (identifier) @definition.var)) (const_declaration (const_definition name: (identifier) @definition.var))
(identifier) @reference (identifier) @reference
(type_identifier) @reference
((call_expression function: (identifier) @reference) ((call_expression name: (reference_expression (identifier)) @reference)
(#set! reference.kind "call")) (#set! reference.kind "call"))
((call_expression ((call_expression
function: (selector_expression name: (selector_expression
field: (identifier) @definition.function)) field: (reference_expression (identifier) @definition.function)))
(#set! reference.kind "call")) (#set! reference.kind "call"))
(source_file) @scope (source_file) @scope