aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPorterAtGoogle <70230577+PorterAtGoogle@users.noreply.github.com>2023-09-18 10:26:02 -0600
committerGitHub <noreply@github.com>2023-09-19 01:26:02 +0900
commitb4f6dd72980607a9821d24502b0ca7ee826376af (patch)
treec6e90c12315b6767225e987e7b11c52276b2719a
parentUpdate README (#5419) (diff)
downloadnvim-treesitter-b4f6dd72980607a9821d24502b0ca7ee826376af.tar
nvim-treesitter-b4f6dd72980607a9821d24502b0ca7ee826376af.tar.gz
nvim-treesitter-b4f6dd72980607a9821d24502b0ca7ee826376af.tar.bz2
nvim-treesitter-b4f6dd72980607a9821d24502b0ca7ee826376af.tar.lz
nvim-treesitter-b4f6dd72980607a9821d24502b0ca7ee826376af.tar.xz
nvim-treesitter-b4f6dd72980607a9821d24502b0ca7ee826376af.tar.zst
nvim-treesitter-b4f6dd72980607a9821d24502b0ca7ee826376af.zip
feat(textproto): Add Textproto parser and queries (#5402)
* Add textproto parser and queries * remove extra newline * Apply suggestions from code review Co-authored-by: ObserverOfTime <chronobserver@disroot.org> --------- Co-authored-by: ObserverOfTime <chronobserver@disroot.org>
-rw-r--r--README.md1
-rw-r--r--lockfile.json3
-rw-r--r--lua/nvim-treesitter/parsers.lua8
-rw-r--r--queries/textproto/folds.scm5
-rw-r--r--queries/textproto/highlights.scm18
-rw-r--r--queries/textproto/indents.scm7
-rw-r--r--scripts/minimal_init.lua1
7 files changed, 43 insertions, 0 deletions
diff --git a/README.md b/README.md
index 7dbc96ebf..23a411c5d 100644
--- a/README.md
+++ b/README.md
@@ -367,6 +367,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [tablegen](https://github.com/amaanq/tree-sitter-tablegen) (maintained by @amaanq)
- [x] [teal](https://github.com/euclidianAce/tree-sitter-teal) (maintained by @euclidianAce)
- [x] [terraform](https://github.com/MichaHoffmann/tree-sitter-hcl) (maintained by @MichaHoffmann)
+- [x] [textproto](https://github.com/PorterAtGoogle/tree-sitter-textproto) (maintained by @Porter)
- [x] [thrift](https://github.com/duskmoon314/tree-sitter-thrift) (maintained by @amaanq, @duskmoon314)
- [x] [tiger](https://github.com/ambroisie/tree-sitter-tiger) (maintained by @ambroisie)
- [x] [tlaplus](https://github.com/tlaplus-community/tree-sitter-tlaplus) (maintained by @ahelwer, @susliko)
diff --git a/lockfile.json b/lockfile.json
index 1d91350e8..2c55b867d 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -581,6 +581,9 @@
"terraform": {
"revision": "b5539065432c08e4118eb3ee7c94902fdda85708"
},
+ "textproto": {
+ "revision": "8dacf02aa402892c91079f8577998ed5148c0496"
+ },
"thrift": {
"revision": "d4deb1bd9e848f2dbe81103a151d99e8546de480"
},
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index 2880edec7..be26b8f4c 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -1707,6 +1707,14 @@ list.terraform = {
maintainers = { "@MichaHoffmann" },
}
+list.textproto = {
+ install_info = {
+ url = "https://github.com/PorterAtGoogle/tree-sitter-textproto",
+ files = { "src/parser.c" },
+ },
+ maintainers = { "@Porter" },
+}
+
list.thrift = {
install_info = {
url = "https://github.com/duskmoon314/tree-sitter-thrift",
diff --git a/queries/textproto/folds.scm b/queries/textproto/folds.scm
new file mode 100644
index 000000000..f6eeead9a
--- /dev/null
+++ b/queries/textproto/folds.scm
@@ -0,0 +1,5 @@
+[
+ (message_value)
+ (scalar_list)
+ (message_list)
+] @fold
diff --git a/queries/textproto/highlights.scm b/queries/textproto/highlights.scm
new file mode 100644
index 000000000..8ebb476e5
--- /dev/null
+++ b/queries/textproto/highlights.scm
@@ -0,0 +1,18 @@
+(string) @string
+
+(field_name) @field
+
+(comment) @comment
+
+(number) @number
+; For stuff like "inf" and "-inf".
+(scalar_value [ (identifier) (signed_identifier) ]) @number
+
+[
+ (open_squiggly)
+ (close_squiggly)
+ (open_square)
+ (close_square)
+ (open_arrow)
+ (close_arrow)
+] @punctuation.bracket
diff --git a/queries/textproto/indents.scm b/queries/textproto/indents.scm
new file mode 100644
index 000000000..fd6db7ffb
--- /dev/null
+++ b/queries/textproto/indents.scm
@@ -0,0 +1,7 @@
+(message_value) @indent.begin
+(message_value (close_squiggly) @indent.branch)
+
+(scalar_list) @indent.begin
+(scalar_list (close_square) @indent.branch)
+(message_list) @indent.begin
+(message_list (close_square) @indent.branch)
diff --git a/scripts/minimal_init.lua b/scripts/minimal_init.lua
index f7a7ee590..45a7b0243 100644
--- a/scripts/minimal_init.lua
+++ b/scripts/minimal_init.lua
@@ -8,6 +8,7 @@ vim.filetype.add {
cmm = "t32",
hurl = "hurl",
ncl = "nickel",
+ textproto = "textproto",
tig = "tiger",
usd = "usd",
usda = "usd",