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

feat: add protobuf language support #614

Merged
merged 2 commits into from
Aug 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,7 @@
path = helix-syntax/languages/tree-sitter-ledger
url = https://github.com/cbarrete/tree-sitter-ledger
shallow = true
[submodule "helix-syntax/languages/tree-sitter-protobuf"]
path = helix-syntax/languages/tree-sitter-protobuf
url = https://github.com/yusdacra/tree-sitter-protobuf.git
shallow = true
1 change: 1 addition & 0 deletions helix-syntax/languages/tree-sitter-protobuf
Submodule tree-sitter-protobuf added at 3eb3da
10 changes: 10 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ comment-token = "#"

indent = { tab-width = 2, unit = " " }

[[language]]
name = "protobuf"
scope = "source.proto"
injection-regex = "protobuf"
file-types = ["proto"]
roots = []
comment-token = "//"

indent = { tab-width = 2, unit = " " }

[[language]]
name = "elixir"
scope = "source.elixir"
Expand Down
60 changes: 60 additions & 0 deletions runtime/queries/protobuf/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[
"syntax"
"package"
"option"
"import"
"service"
"rpc"
"returns"
"message"
"enum"
"oneof"
"repeated"
"reserved"
"to"
"stream"
"extend"
] @keyword

[
(keyType)
(type)
] @type.builtin

[
(mapName)
(oneofName)
(enumName)
(messageName)
(extendName)
(serviceName)
(rpcName)
] @type

[
(fieldName)
(optionName)
] @property
(enumVariantName) @type.enum.variant

(fullIdent) @namespace

[
(intLit)
(floatLit)
] @number
(boolLit) @constant.builtin
(strLit) @string

(constant) @constant

(comment) @comment

[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
12 changes: 12 additions & 0 deletions runtime/queries/protobuf/indents.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
indent = [
"messageBody",
"enumBody",
"oneofBody",
"serviceBody",
"rpcBody",
"msgLit",
]

outdent = [
"}",
]