Add protobuf support (#6748)

Release Notes:

- Added protobuf syntax highlighting
([#5160](https://github.com/zed-industries/zed/issues/5160)).
This commit is contained in:
Derrick Laird
2024-01-30 21:08:10 +02:00
committed by GitHub
parent dfbcaf36fc
commit 7bfa584eb6
8 changed files with 109 additions and 0 deletions
+1
View File
@@ -295,6 +295,7 @@ pub fn init(
tree_sitter_uiua::language(),
vec![Arc::new(uiua::UiuaLanguageServer {})],
);
language("proto", tree_sitter_proto::language(), vec![]);
if let Ok(children) = std::fs::read_dir(&*PLUGINS_DIR) {
for child in children {
@@ -0,0 +1,12 @@
name = "proto"
path_suffixes = ["proto"]
line_comments = ["// "]
autoclose_before = ";:.,=}])>"
brackets = [
{ start = "{", end = "}", close = true, newline = true },
{ start = "[", end = "]", close = true, newline = true },
{ start = "(", end = ")", close = true, newline = true },
{ start = "\"", end = "\"", close = true, newline = false, not_in = ["comment", "string"] },
{ start = "'", end = "'", close = true, newline = false, not_in = ["comment", "string"] },
{ start = "/*", end = " */", close = true, newline = false, not_in = ["comment", "string"] },
]
@@ -0,0 +1,61 @@
[
"syntax"
"package"
"option"
"optional"
"import"
"service"
"rpc"
"returns"
"message"
"enum"
"oneof"
"repeated"
"reserved"
"to"
] @keyword
[
(key_type)
(type)
(message_name)
(enum_name)
(service_name)
(rpc_name)
(message_or_enum_type)
] @type
(enum_field
(identifier) @constant)
[
(string)
"\"proto3\""
] @string
(int_lit) @number
[
(true)
(false)
] @boolean
(comment) @comment
[
"("
")"
"["
"]"
"{"
"}"
"<"
">"
] @punctuation.bracket
[
";"
","
] @punctuation.delimiter
"=" @operator
@@ -0,0 +1,19 @@
(message
"message" @context
(message_name
(identifier) @name)) @item
(service
"service" @context
(service_name
(identifier) @name)) @item
(rpc
"rpc" @context
(rpc_name
(identifier) @name)) @item
(enum
"enum" @context
(enum_name
(identifier) @name)) @item