diff --git a/languages.toml b/languages.toml index 23bd5fc93234..81ca7e77f7bb 100644 --- a/languages.toml +++ b/languages.toml @@ -340,16 +340,17 @@ source = { git = "https://github.com/Beaglefoot/tree-sitter-awk", rev = "a799bc5 [[language]] name = "protobuf" scope = "source.proto" -injection-regex = "protobuf" +injection-regex = "proto" file-types = ["proto"] language-servers = [ "bufls", "pbkit" ] comment-token = "//" block-comment-tokens = { start = "/*", end = "*/" } indent = { tab-width = 2, unit = " " } +grammar = "proto" [[grammar]] -name = "protobuf" -source = { git = "https://github.com/yusdacra/tree-sitter-protobuf", rev = "19c211a01434d9f03efff99f85e19f967591b175"} +name = "proto" +source = { git = "https://github.com/sdoerner/tree-sitter-proto", rev = "778ab6ed18a7fcf82c83805a87d63376c51e80bc"} [[language]] name = "textproto" diff --git a/runtime/queries/protobuf/highlights.scm b/runtime/queries/protobuf/highlights.scm index 6deee7df8116..15dd7bb3a578 100644 --- a/runtime/queries/protobuf/highlights.scm +++ b/runtime/queries/protobuf/highlights.scm @@ -1,5 +1,6 @@ [ "syntax" + "edition" "package" "option" "import" @@ -7,44 +8,45 @@ "rpc" "returns" "message" + "map" "enum" "oneof" "repeated" + "optional" + "required" "reserved" "to" "stream" "extend" - "optional" ] @keyword [ - (keyType) + (key_type) (type) + (message_or_enum_type) ] @type.builtin [ - (mapName) - (enumName) - (messageName) - (extendName) - (serviceName) - (rpcName) + (enum_name) + (message_name) + (service_name) + (rpc_name) ] @type [ - (fieldName) - (optionName) + (field_name) + (option_name) ] @variable.other.member -(enumVariantName) @type.enum.variant +(enum_variant_name) @type.enum.variant -(fullIdent) @namespace +(full_ident) @namespace -(intLit) @constant.numeric.integer -(floatLit) @constant.numeric.float -(boolLit) @constant.builtin.boolean -(strLit) @string +(int_lit) @constant.numeric.integer +(float_lit) @constant.numeric.float +(bool) @constant.builtin.boolean +(string) @string -(constant) @constant +(block_lit) @constant (comment) @comment @@ -55,12 +57,8 @@ "]" "{" "}" -] @punctuation.bracket +] @punctuation.bracket -[ - "=" -] @operator +"=" @operator -[ - ";" -] @punctuation.delimiter +";" @punctuation.delimiter diff --git a/runtime/queries/protobuf/indents.scm b/runtime/queries/protobuf/indents.scm index d457d75f1998..d55e81b2da17 100644 --- a/runtime/queries/protobuf/indents.scm +++ b/runtime/queries/protobuf/indents.scm @@ -1,10 +1,10 @@ [ - (messageBody) - (enumBody) - (oneofBody) - (serviceBody) - (rpcBody) - (msgLit) + (message_body) + (enum_body) + (oneof_body) + (service_body) + (rpc_body) + (block_lit) ] @indent "}" @outdent diff --git a/runtime/queries/protobuf/textobjects.scm b/runtime/queries/protobuf/textobjects.scm index 6f06b13498b3..7b0cfb198557 100644 --- a/runtime/queries/protobuf/textobjects.scm +++ b/runtime/queries/protobuf/textobjects.scm @@ -1,9 +1,9 @@ -(message (messageBody) @class.inside) @class.around -(enum (enumBody) @class.inside) @class.around -(service (serviceBody) @class.inside) @class.around +(message (message_body) @class.inside) @class.around +(enum (enum_body) @class.inside) @class.around +(service (service_body) @class.inside) @class.around -(rpc (enumMessageType) @parameter.inside) @function.inside -(rpc (enumMessageType) @parameter.around) @function.around +(rpc (message_or_enum_type) @parameter.inside) @function.inside +(rpc (message_or_enum_type) @parameter.around) @function.around (comment) @comment.inside (comment)+ @comment.around