From 982917803e564337cdf2a6159b90e7dd3885236d Mon Sep 17 00:00:00 2001 From: Andrew Dupont Date: Thu, 1 Feb 2024 08:57:11 -0800 Subject: [PATCH] [language-php] Fix block comments failing to re-highlight --- .../grammars/tree-sitter/queries/highlights.scm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/language-php/grammars/tree-sitter/queries/highlights.scm b/packages/language-php/grammars/tree-sitter/queries/highlights.scm index 0af6dde5d..cd3ab01e7 100644 --- a/packages/language-php/grammars/tree-sitter/queries/highlights.scm +++ b/packages/language-php/grammars/tree-sitter/queries/highlights.scm @@ -511,16 +511,22 @@ (#match? @punctuation.definition.comment.php "^#") (#set! adjust.startAndEndAroundFirstMatchOf "^#")) +; All block comments get re-highlighted whenever a change takes place inside +; them. +((comment) @_IGNORE_ + (#match? @_IGNORE_ "^/\\*") + (#set! highlight.invalidateOnChange true)) + ; Capture these because the PHPDoc injection won't process them… ((comment) @comment.block.documentation.php - (#match? @comment.block.documentation.php "^/\\*\\*\\*")) + (#match? @comment.block.documentation.php "^/\\*\\*\\*") + (#set! highlight.invalidateOnChange true)) ; …but otherwise leave this style of comment to be handled by PHPDoc. ((comment) @_IGNORE_ (#match? @_IGNORE_ "^/\\*\\*") (#set! capture.final true)) - ((comment) @comment.block.php (#match? @comment.block.php "^/\\*(?!\\*)"))