HTML Comments Not Colour Coded when there is a <?php> in the script tag. Fixes #28354

This commit is contained in:
Martin Aeschlimann
2017-06-19 11:52:34 +02:00
parent 94af79ff01
commit be2b6bd127
6 changed files with 1521 additions and 505 deletions

View 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);