aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRiley Bruins <ribru17@hotmail.com>2025-08-30 20:39:35 -0700
committerChristian Clason <ch.clason+github@icloud.com>2025-08-31 08:06:48 +0200
commit8fccdb3d493178994aca43ec1f6ff74740eed7ee (patch)
tree9f91b3d1a3167ad9ea9d8dfb5537aab561653c8b
parentfeat(wxml): add parser and queries (diff)
downloadnvim-treesitter-8fccdb3d493178994aca43ec1f6ff74740eed7ee.tar
nvim-treesitter-8fccdb3d493178994aca43ec1f6ff74740eed7ee.tar.gz
nvim-treesitter-8fccdb3d493178994aca43ec1f6ff74740eed7ee.tar.bz2
nvim-treesitter-8fccdb3d493178994aca43ec1f6ff74740eed7ee.tar.lz
nvim-treesitter-8fccdb3d493178994aca43ec1f6ff74740eed7ee.tar.xz
nvim-treesitter-8fccdb3d493178994aca43ec1f6ff74740eed7ee.tar.zst
nvim-treesitter-8fccdb3d493178994aca43ec1f6ff74740eed7ee.zip
feat(proto): more delimiter, property highlights
-rw-r--r--runtime/queries/proto/highlights.scm18
-rw-r--r--tests/query/highlights/proto/test.proto62
2 files changed, 80 insertions, 0 deletions
diff --git a/runtime/queries/proto/highlights.scm b/runtime/queries/proto/highlights.scm
index 51f44a754..894686dd4 100644
--- a/runtime/queries/proto/highlights.scm
+++ b/runtime/queries/proto/highlights.scm
@@ -1,3 +1,19 @@
+(full_ident
+ (identifier) @variable)
+
+(full_ident
+ (identifier)
+ (identifier) @variable.member)
+
+(field
+ (identifier) @property)
+
+(field_option
+ (identifier) @property)
+
+(block_lit
+ (identifier) @property)
+
[
"extend"
"extensions"
@@ -77,6 +93,8 @@
[
";"
","
+ "."
+ ":"
] @punctuation.delimiter
"=" @operator
diff --git a/tests/query/highlights/proto/test.proto b/tests/query/highlights/proto/test.proto
new file mode 100644
index 000000000..fdc610782
--- /dev/null
+++ b/tests/query/highlights/proto/test.proto
@@ -0,0 +1,62 @@
+syntax = "proto2";
+// ^^^^^^^^ @string.special
+package sls.asfd.asfd;
+// ^^^ @variable
+// ^ @punctuation.delimiter
+// ^^^^ @variable.member
+// ^ @punctuation.delimiter
+// ^^^^ @variable.member
+// ^ @punctuation.delimiter
+
+import "github.com/gogo/protobuf/gogoproto/gogo.proto";
+import "github.com/gogo/protobuf/gogoproto/gogo.proto";
+import "github.com/gogo/protobuf/gogoproto/gogo.proto";
+import "github.com/gogo/protobuf/gogoproto/gogo.proto";
+import "github.com/gogo/protobuf/gogoproto/gogo.proto";
+import "github.com/gogo/protobuf/gogoproto/gogo.proto";
+import "github.com/gogo/protobuf/gogoproto/gogo.proto";
+import "github.com/gogo/protobuf/gogoproto/gogo.proto";
+//<- @keyword.import
+
+option (gogoproto.sizer_all) = true;
+option (gogoproto.marshaler_all) = true;
+option (gogoproto.unmarshaler_all.foo) = true;
+// ^^^^^^^^^ @variable
+// ^^^^^^^^^^^^^^^ @variable.member
+// ^ @punctuation.delimiter
+// ^^^ @variable.member
+
+message LogContent
+//<- @keyword.type
+{
+ required string Key = 1;
+// ^^^^^^ @type
+// ^^^ @property
+// ^ @operator
+// ^ @number
+ required string Value = 2;
+// ^^^^^^ @type
+// ^^^^^ @property
+ required CustomType Value = 2;
+// ^^^^^^^^ @keyword.modifier
+// ^^^^^^^^^^ @type
+
+ optional string cgroup_pids_mount = 76 [default = "/sys/fs/cgroup/pids"];
+
+ optional JsonFormat json_format = 6 [
+// ^^^^^^^^ @keyword.modifier
+ retention = RETENTION_RUNTIME,
+// ^^^^^^^^^^^^^^^^^ @variable
+// ^ @punctuation.delimiter
+ targets = TARGET_TYPE_MESSAGE,
+// ^^^^^^^ @property
+ targets = TARGET_TYPE_ENUM,
+ targets = TARGET_TYPE_FILE,
+ edition_defaults = { edition: "2023", value: "ALLOW" }
+// ^^^^^^^ @property
+// ^ @punctuation.delimiter
+// ^ @punctuation.delimiter
+// ^ @punctuation.bracket
+ ];
+}
+