feat(proto): sync highlights with upstream

Syncs with coder3101/tree-sitter-proto#22, which adjusts captures to
better align with nvim-treesitter conventions:

- Package idents use @module, extend/oneof idents use @type
- Adds map_field, oneof_field @property captures
- option/syntax/edition use @keyword.directive
- extend/extensions/oneof/service moved to @keyword.type
- key_type/type use @type.builtin; rpc_name uses @function.method
- Import paths use @string.special.path
- proto2/proto3 syntax strings use @string.special.symbol
- Simplifies comment captures (removes doc comment distinction)

Honestly not sure how well other tree-sitter clients handle the
nvim-specific highlights, but I figure this is the primary client I'm
(at least personally) concerned about.
This commit is contained in:
Stefan VanBuren 2026-03-13 10:40:11 -04:00
parent ebc3201290
commit fb60ea759a
No known key found for this signature in database

View file

@ -1,13 +1,27 @@
(full_ident (package
(identifier) @variable) (full_ident
(identifier) @module))
(full_ident (extend
(identifier) (full_ident
(identifier) @variable.member) (identifier) @type))
(constant
(full_ident
(identifier) @constant))
(field (field
(identifier) @property) (identifier) @property)
(map_field
(identifier) @property)
(oneof
(identifier) @type)
(oneof_field
(identifier) @property)
(field_option (field_option
(identifier) @property) (identifier) @property)
@ -18,23 +32,26 @@
(identifier) @property) (identifier) @property)
[ [
"extend"
"extensions"
"oneof"
"option" "option"
"reserved"
"syntax" "syntax"
"edition" "edition"
] @keyword.directive
[
"reserved"
"to" "to"
"max" "max"
] @keyword ] @keyword
[ [
"enum" "enum"
"extend"
"extensions"
"group" "group"
"service"
"message" "message"
"map" "map"
"oneof"
"service"
] @keyword.type ] @keyword.type
"rpc" @keyword.function "rpc" @keyword.function
@ -60,22 +77,29 @@
[ [
(key_type) (key_type)
(type) (type)
] @type.builtin
[
(message_name) (message_name)
(enum_name) (enum_name)
(service_name) (service_name)
(rpc_name)
(message_or_enum_type) (message_or_enum_type)
] @type ] @type
(rpc_name) @function.method
(enum_field (enum_field
(identifier) @constant) (identifier) @constant)
(string) @string (string) @string
(import
path: (string) @string.special.path)
[ [
"\"proto3\"" "\"proto3\""
"\"proto2\"" "\"proto2\""
] @string.special ] @string.special.symbol
(escape_sequence) @string.escape (escape_sequence) @string.escape
@ -88,10 +112,9 @@
(false) (false)
] @boolean ] @boolean
(comment) @comment @spell (comment) @spell
((comment) @comment.documentation (comment) @comment
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
[ [
"(" "("