on master help sign in
feat: add protobuf tree-sitter parser with highlighting queries
commit4b45f27a13500bd5f85d11e2e3bcda49bfdd065c authorYusuf Bera Ertan <y.bera003.06@protonmail.com> dateWed 18 Aug 2021, 13:54 (5 years ago) parent1158fc4
4 files changed+75
.gitmodules+4 helix-syntax/languages/tree-sitter-protobuf+1 languages.toml+10 runtime/queries/protobuf/highlights.scm+60
.gitmodules+4
@@ -98,3 +98,7 @@
9898 path = helix-syntax/languages/tree-sitter-ledger
9999 url = https://github.com/cbarrete/tree-sitter-ledger
100100 shallow = true
101+[submodule "helix-syntax/languages/tree-sitter-protobuf"]
102+ path = helix-syntax/languages/tree-sitter-protobuf
103+ url = https://github.com/yusdacra/tree-sitter-protobuf.git
104+ shallow = true
helix-syntax/languages/tree-sitter-protobufnew file+1

Submodule changed.

languages.toml+10
@@ -30,6 +30,16 @@ comment-token = "#"
3030
3131indent = { tab-width = 2, unit = " " }
3232
33+[[language]]
34+name = "protobuf"
35+scope = "source.proto"
36+injection-regex = "protobuf"
37+file-types = ["proto"]
38+roots = []
39+comment-token = "//"
40+
41+indent = { tab-width = 2, unit = " " }
42+
3343[[language]]
3444name = "elixir"
3545scope = "source.elixir"
runtime/queries/protobuf/highlights.scmnew file+60
@@ -0,0 +1,60 @@
1+[
2+ "syntax"
3+ "package"
4+ "option"
5+ "import"
6+ "service"
7+ "rpc"
8+ "returns"
9+ "message"
10+ "enum"
11+ "oneof"
12+ "repeated"
13+ "reserved"
14+ "to"
15+ "stream"
16+ "extend"
17+] @keyword
18+
19+[
20+ (keyType)
21+ (type)
22+] @type.builtin
23+
24+[
25+ (mapName)
26+ (oneofName)
27+ (enumName)
28+ (messageName)
29+ (extendName)
30+ (serviceName)
31+ (rpcName)
32+] @type
33+
34+[
35+ (fieldName)
36+ (optionName)
37+] @property
38+(enumVariantName) @type.enum.variant
39+
40+(fullIdent) @namespace
41+
42+[
43+ (intLit)
44+ (floatLit)
45+] @number
46+(boolLit) @constant.builtin
47+(strLit) @string
48+
49+(constant) @constant
50+
51+(comment) @comment
52+
53+[
54+ "("
55+ ")"
56+ "["
57+ "]"
58+ "{"
59+ "}"
60+] @punctuation.bracket