Skip to content

Commit

Permalink
Add textobject queries for protobuf grammar.
Browse files Browse the repository at this point in the history
Given `message Foo {string s = 1;}`
- `mat` selects `message Foo {string s = 1}`
- `mit` selects `{string s = 1;}`

Given `service SearchService { rpc Search(Req) returns (Resp); }
- `mit` or `mat` selects `Req` or `Resp`
- `mif` or `maf` selects `rpc Search(Req) returns (Resp);`
- `mit` selects { rpc Search(Req) returns (Resp); }`
- `mat` selects `service SearchService { rpc Search(Req) returns (Resp); }`
  • Loading branch information
rcorre committed Dec 28, 2023
1 parent 783ff27 commit 688e019
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
| ponylang |||| |
| prisma || | | `prisma-language-server` |
| prolog | | | | `swipl` |
| protobuf || || `bufls`, `pb` |
| protobuf || || `bufls`, `pb` |
| prql || | | |
| purescript ||| | `purescript-language-server` |
| python |||| `pylsp` |
Expand Down
9 changes: 9 additions & 0 deletions runtime/queries/protobuf/textobjects.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(message (messageBody) @class.inside) @class.around
(enum (enumBody) @class.inside) @class.around
(service (serviceBody) @class.inside) @class.around

(rpc (enumMessageType) @parameter.inside) @function.inside
(rpc (enumMessageType) @parameter.around) @function.around

(comment) @comment.inside
(comment)+ @comment.around

0 comments on commit 688e019

Please sign in to comment.