diff options
| author | francisco souza <108725+fsouza@users.noreply.github.com> | 2022-04-26 15:36:26 -0400 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2022-04-28 00:05:57 +0200 |
| commit | 1d5e4f3aa1e2368ce29c53b48b5e53702b002052 (patch) | |
| tree | b4b0620fdc121c2cdc2b0358be2423ba344207b5 | |
| parent | 9fdd6765fc05632c2f3af1ad825dc4e9cc0b041f (diff) | |
feat(proto): add parser
Related to #2307.
| -rw-r--r-- | lua/nvim-treesitter/parsers.lua | 10 | ||||
| -rw-r--r-- | queries/proto/folds.scm | 5 | ||||
| -rw-r--r-- | queries/proto/highlights.scm | 62 |
3 files changed, 77 insertions, 0 deletions
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 8682d48e..4ac58758 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 00000000..645ac181 --- /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 00000000..a859ef41 --- /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 |
