Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
php: Highlight PHPDoc comments (#11695)
claytonrcarter748cd38d7710
diff --git a/extensions/php/extension.toml b/extensions/php/extension.tomlindex dd9218303a1..e8d678be9f1 100644--- a/extensions/php/extension.toml+++ b/extensions/php/extension.toml@@ -15,3 +15,7 @@ language_ids = { PHP = "php"}repository = "https://github.com/tree-sitter/tree-sitter-php"commit = "8ab93274065cbaf529ea15c24360cfa3348ec9e4"path = "php"++[grammars.phpdoc]+repository = "https://github.com/claytonrcarter/tree-sitter-phpdoc"+commit = "1d0e255b37477d0ca46f1c9e9268c8fa76c0b3fc"diff --git a/extensions/php/languages/php/injections.scm b/extensions/php/languages/php/injections.scmindex 57abd8ea2b0..3b5cd70064c 100644--- a/extensions/php/languages/php/injections.scm+++ b/extensions/php/languages/php/injections.scm@@ -1,3 +1,7 @@((text) @content(#set! "language" "html")(#set! "combined"))++((comment) @content+ (#match? @content "^/\\*\\*[^*]")+ (#set! "language" "phpdoc"))diff --git a/extensions/php/languages/phpdoc/config.toml b/extensions/php/languages/phpdoc/config.tomlnew file mode 100644index 00000000000..78aa5e64aa3--- /dev/null+++ b/extensions/php/languages/phpdoc/config.toml@@ -0,0 +1,9 @@+name = "PHPDoc"+grammar = "phpdoc"+autoclose_before = "]})>"+brackets = [+ { start = "{", end = "}", close = true, newline = false },+ { start = "[", end = "]", close = true, newline = false },+ { start = "(", end = ")", close = true, newline = false },+ { start = "<", end = ">", close = true, newline = false },+]diff --git a/extensions/php/languages/phpdoc/highlights.scm b/extensions/php/languages/phpdoc/highlights.scmnew file mode 100644index 00000000000..767d8e62207--- /dev/null+++ b/extensions/php/languages/phpdoc/highlights.scm@@ -0,0 +1,13 @@+(tag_name) @keyword++(tag (variable_name) @variable)+(variable_name "$" @operator)++(tag+ (tag_name) @keyword+ (#eq? @keyword "@method")+ (name) @function.method)++(primitive_type) @type.builtin+(named_type (name) @type) @type+(named_type (qualified_name) @type) @type