aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lua/nvim-treesitter/parsers.lua10
-rw-r--r--queries/proto/folds.scm5
-rw-r--r--queries/proto/highlights.scm62
3 files changed, 77 insertions, 0 deletions
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index 8682d48eb..4ac58758d 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -1050,6 +1050,16 @@ list.m68k = {
filetype = "asm68k",
}
+list.proto = {
+ install_info = {
+ url = "https://github.com/mitchellh/tree-sitter-proto",
+ branch = "main",
+ files = { "src/parser.c" },
+ },
+ maintainers = { "@fsouza" },
+ filetype = "proto",
+}
+
local M = {
list = list,
filetype_to_parsername = filetype_to_parsername,
diff --git a/queries/proto/folds.scm b/queries/proto/folds.scm
new file mode 100644
index 000000000..645ac1819
--- /dev/null
+++ b/queries/proto/folds.scm
@@ -0,0 +1,5 @@
+[
+ (enum)
+ (message)
+ (service)
+] @fold
diff --git a/queries/proto/highlights.scm b/queries/proto/highlights.scm
new file mode 100644
index 000000000..a859ef418
--- /dev/null
+++ b/queries/proto/highlights.scm
@@ -0,0 +1,62 @@
+[
+ "syntax"
+ "package"
+ "option"
+ "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
+
+(float_lit) @float
+
+[
+ (true)
+ (false)
+] @boolean
+
+(comment) @comment
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+ "<"
+ ">"
+] @punctuation.bracket
+
+[
+ ";"
+ ","
+] @punctuation.delimiter
+
+"=" @operator