on master help sign in
Add Vlang tree-sitter in the languages.toml (#2526)

Co-authored-by: pancake <pancake@nopcode.org> Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

commit7706a4a0d8b67b943c31d0c5f7b00d357b5d838d authorpancake <pancake@nowsecure.com> dateSat 28 May 2022, 21:46 (4 years ago) parent7c107d0
3 files changed+166
book/src/generated/lang-support.md+1 languages.toml+15 runtime/queries/v/highlights.scm+150
book/src/generated/lang-support.md+1
@@ -89,6 +89,7 @@
8989| tsx | ✓ | | | `typescript-language-server` |
9090| twig | ✓ | | | |
9191| typescript | ✓ | | ✓ | `typescript-language-server` |
92+| v | ✓ | | | `vls` |
9293| vala | ✓ | | | `vala-language-server` |
9394| verilog | ✓ | ✓ | | `svlangserver` |
9495| vue | ✓ | | | `vls` |
languages.toml+15
@@ -1381,6 +1381,21 @@ indent = { tab-width = 2, unit = " " }
13811381name = "scheme"
13821382source = { git = "https://github.com/6cdh/tree-sitter-scheme", rev = "27fb77db05f890c2823b4bd751c6420378df146b" }
13831383
1384+[[language]]
1385+name = "v"
1386+scope = "source.v"
1387+file-types = ["v", "vv"]
1388+shebangs = ["v run"]
1389+roots = ["v.mod"]
1390+language-server = { command = "vls", args = [] }
1391+auto-format = true
1392+comment-token = "//"
1393+indent = { tab-width = 4, unit = "\t" }
1394+
1395+[[grammar]]
1396+name = "v"
1397+source = { git = "https://github.com/vlang/vls", subpath = "tree_sitter_v", rev = "3e8124ea4ab80aa08ec77f03df53f577902a0cdd" }
1398+
13841399[[language]]
13851400name = "verilog"
13861401scope = "source.verilog"
runtime/queries/v/highlights.scmnew file+150
@@ -0,0 +1,150 @@
1+(parameter_declaration
2+ name: (identifier) @variable.parameter)
3+(function_declaration
4+ name: (identifier) @function)
5+(function_declaration
6+ receiver: (parameter_list)
7+ name: (identifier) @function.method)
8+
9+(call_expression
10+ function: (identifier) @function)
11+(call_expression
12+ function: (selector_expression
13+ field: (identifier) @function.method))
14+
15+(field_identifier) @variable.other.member
16+(selector_expression
17+ field: (identifier) @variable.other.member)
18+
19+(int_literal) @constant.numeric.integer
20+(interpreted_string_literal) @string
21+(rune_literal) @string
22+(escape_sequence) @constant.character.escape
23+
24+[
25+ (type_identifier)
26+ (builtin_type)
27+ (pointer_type)
28+ (array_type)
29+] @type
30+
31+[
32+ (identifier)
33+ (module_identifier)
34+ (import_path)
35+] @variable
36+
37+[
38+ "as"
39+ "asm"
40+ "assert"
41+ ;"atomic"
42+ ;"break"
43+ "const"
44+ ;"continue"
45+ "defer"
46+ "else"
47+ "enum"
48+ "fn"
49+ "for"
50+ "$for"
51+ "go"
52+ "goto"
53+ "if"
54+ "$if"
55+ "import"
56+ "in"
57+ "!in"
58+ "interface"
59+ "is"
60+ "!is"
61+ "lock"
62+ "match"
63+ "module"
64+ "mut"
65+ "or"
66+ "pub"
67+ "return"
68+ "rlock"
69+ "select"
70+ ;"shared"
71+ ;"static"
72+ "struct"
73+ "type"
74+ ;"union"
75+ "unsafe"
76+] @keyword
77+
78+[
79+ (true)
80+ (false)
81+] @boolean
82+
83+[
84+ "."
85+ ","
86+ ":"
87+ ";"
88+] @punctuation.delimiter
89+
90+[
91+ "("
92+ ")"
93+ "{"
94+ "}"
95+ "["
96+ "]"
97+] @punctuation.bracket
98+
99+(array) @punctuation.bracket
100+
101+[
102+ "++"
103+ "--"
104+
105+ "+"
106+ "-"
107+ "*"
108+ "/"
109+ "%"
110+
111+ "~"
112+ "&"
113+ "|"
114+ "^"
115+
116+ "!"
117+ "&&"
118+ "||"
119+ "!="
120+
121+ "<<"
122+ ">>"
123+
124+ "<"
125+ ">"
126+ "<="
127+ ">="
128+
129+ "+="
130+ "-="
131+ "*="
132+ "/="
133+ "&="
134+ "|="
135+ "^="
136+ "<<="
137+ ">>="
138+
139+ "="
140+ ":="
141+ "=="
142+
143+ "?"
144+ "<-"
145+ "$"
146+ ".."
147+ "..."
148+] @operator
149+
150+(comment) @comment