mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 11:08:51 +01:00
HTML Comments Not Colour Coded when there is a <?php> in the script tag. Fixes #28354
This commit is contained in:
24
extensions/php/build/update-grammar.js
Normal file
24
extensions/php/build/update-grammar.js
Normal file
@@ -0,0 +1,24 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
var updateGrammar = require('../../../build/npm/update-grammar');
|
||||
|
||||
function adaptInjectionScope(grammar) {
|
||||
// we're using the HTML grammar from https://github.com/textmate/html.tmbundle which has moved away from source.js.embedded.html
|
||||
let oldInjectionKey = "text.html.php - (meta.embedded | meta.tag), L:text.html.php meta.tag, L:source.js.embedded.html";
|
||||
let newInjectionKey = "text.html.php - (meta.embedded | meta.tag), L:text.html.php meta.tag, L:text.html.php source.js";
|
||||
|
||||
var injections = grammar.injections;
|
||||
var injection = injections[oldInjectionKey];
|
||||
if (!injections) {
|
||||
throw "Can not find PHP injection";
|
||||
}
|
||||
delete injections[oldInjectionKey];
|
||||
injections[newInjectionKey] = injection;
|
||||
}
|
||||
|
||||
updateGrammar.update('atom/language-php', 'grammars/php.cson', './syntaxes/php.tmLanguage.json', adaptInjectionScope);
|
||||
|
||||
Reference in New Issue
Block a user