Skip to content

Commit

Permalink
Add textobject queries for protobuf grammar. (helix-editor#9184)
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 authored and woojiq committed Jan 13, 2024
1 parent 6d5c93b commit cc19021
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 @@ -128,7 +128,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 cc19021

Please sign in to comment.