diff --git a/extensions/php/build/update-grammar.js b/extensions/php/build/update-grammar.js index da01c30d40df5f4ba082bc887202bb5b28daeb2e..9de0d0542332be2c12dfe5d136a2f5dd1bce3f78 100644 --- a/extensions/php/build/update-grammar.js +++ b/extensions/php/build/update-grammar.js @@ -21,6 +21,14 @@ function adaptInjectionScope(grammar) { injections[newInjectionKey] = injection; } +function includeDerivativeHtml(grammar) { + grammar.patterns.forEach(pattern => { + if (pattern.include === 'text.html.basic') { + pattern.include = 'text.html.derivative'; + } + }); +} + // Workaround for https://github.com/Microsoft/vscode/issues/40279 // and https://github.com/Microsoft/vscode-textmate/issues/59 function fixBadRegex(grammar) { @@ -61,4 +69,7 @@ function fixBadRegex(grammar) { } updateGrammar.update('atom/language-php', 'grammars/php.cson', './syntaxes/php.tmLanguage.json', fixBadRegex); -updateGrammar.update('atom/language-php', 'grammars/html.cson', './syntaxes/html.tmLanguage.json', adaptInjectionScope); +updateGrammar.update('atom/language-php', 'grammars/html.cson', './syntaxes/html.tmLanguage.json', grammar => { + adaptInjectionScope(grammar); + includeDerivativeHtml(grammar); +}); diff --git a/extensions/php/syntaxes/html.tmLanguage.json b/extensions/php/syntaxes/html.tmLanguage.json index 09d631c14c2fb0e25fbcf1df66c3de46ce31108e..4bf15294159fbeadc381e90c61b0638210a2a06b 100644 --- a/extensions/php/syntaxes/html.tmLanguage.json +++ b/extensions/php/syntaxes/html.tmLanguage.json @@ -129,7 +129,7 @@ "name": "comment.line.shebang.php" }, { - "include": "text.html.basic" + "include": "text.html.derivative" } ], "repository": { diff --git a/extensions/php/test/colorize-fixtures/issue-76997.php b/extensions/php/test/colorize-fixtures/issue-76997.php new file mode 100644 index 0000000000000000000000000000000000000000..2aedec989997b4233c1a361c17b2d4d720a51b2c --- /dev/null +++ b/extensions/php/test/colorize-fixtures/issue-76997.php @@ -0,0 +1 @@ + diff --git a/extensions/php/test/colorize-results/issue-76997_php.json b/extensions/php/test/colorize-results/issue-76997_php.json new file mode 100644 index 0000000000000000000000000000000000000000..c6863dda6fbf4c599cb1fb9cb0fcb9f10aec9db7 --- /dev/null +++ b/extensions/php/test/colorize-results/issue-76997_php.json @@ -0,0 +1,68 @@ +[ + { + "c": "<", + "t": "text.html.php meta.tag.other.unrecognized.html.derivative punctuation.definition.tag.begin.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "hello", + "t": "text.html.php meta.tag.other.unrecognized.html.derivative entity.name.tag.html", + "r": { + "dark_plus": "entity.name.tag: #569CD6", + "light_plus": "entity.name.tag: #800000", + "dark_vs": "entity.name.tag: #569CD6", + "light_vs": "entity.name.tag: #800000", + "hc_black": "entity.name.tag: #569CD6" + } + }, + { + "c": ">", + "t": "text.html.php meta.tag.other.unrecognized.html.derivative punctuation.definition.tag.end.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + }, + { + "c": "", + "t": "text.html.php meta.tag.other.unrecognized.html.derivative punctuation.definition.tag.end.html", + "r": { + "dark_plus": "punctuation.definition.tag: #808080", + "light_plus": "punctuation.definition.tag: #800000", + "dark_vs": "punctuation.definition.tag: #808080", + "light_vs": "punctuation.definition.tag: #800000", + "hc_black": "punctuation.definition.tag: #808080" + } + } +] \ No newline at end of file