Skip to content

Commit

Permalink
Add support for textproto language.
Browse files Browse the repository at this point in the history
  • Loading branch information
sdoerner committed Oct 12, 2024
1 parent a7651f5 commit 8eb9904
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 0 deletions.
1 change: 1 addition & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
| task || | | |
| tcl || || |
| templ || | | `templ` |
| textproto |||| |
| tfvars || || `terraform-ls` |
| thrift || | | |
| todotxt || | | |
Expand Down
13 changes: 13 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,19 @@ indent = { tab-width = 2, unit = " " }
name = "protobuf"
source = { git = "https://github.com/yusdacra/tree-sitter-protobuf", rev = "19c211a01434d9f03efff99f85e19f967591b175"}

[[language]]
name = "textproto"
file-types = ["txtpb", "textpb", "textproto"]
comment-token = "#"
scope = "source.textproto"
indent = { tab-width = 2, unit = " " }
formatter = { command = "txtpbfmt" }
auto-format = true

[[grammar]]
name = "textproto"
source = { git = "https://github.com/PorterAtGoogle/tree-sitter-textproto", rev = "d900077aef9f5dcb0d47c86be33585013ed5db9a"}

[[language]]
name = "elixir"
scope = "source.elixir"
Expand Down
22 changes: 22 additions & 0 deletions runtime/queries/textproto/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
(string) @string

(field_name) @variable.other.member

(comment) @comment

(number) @constant.numeric
; covers e.g. booleans and "inf"
(scalar_value (identifier)) @constant
; Covers "-inf"
(scalar_value (signed_identifier)) @constant.numeric

[
(open_squiggly)
(close_squiggly)
(open_square)
(close_square)
(open_arrow)
(close_arrow)
] @punctuation.bracket

"," @punctuation.delimiter
11 changes: 11 additions & 0 deletions runtime/queries/textproto/indents.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
(message_value)
(message_list)
(scalar_list)
] @indent

[
(close_arrow)
(close_square)
(close_squiggly)
] @outdent
12 changes: 12 additions & 0 deletions runtime/queries/textproto/textobjects.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(message_field
(_) @entry.inside) @entry.around

(scalar_field
(_) @entry.inside) @entry.around

(message_list
(_) @entry.around)

(scalar_list
(_) @entry.around)

0 comments on commit 8eb9904

Please sign in to comment.