mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
Update the PHP grammar
Now it breaks out the html grammar into its own file
This commit is contained in:
parent
55382a106f
commit
783a0aafad
|
@ -68,8 +68,8 @@ function getCommitSha(repoId, repoPath) {
|
|||
});
|
||||
}
|
||||
|
||||
exports.update = function (repoId, repoPath, dest, modifyGrammar) {
|
||||
var contentPath = 'https://raw.githubusercontent.com/' + repoId + '/master/' + repoPath;
|
||||
exports.update = function (repoId, repoPath, dest, modifyGrammar, version = 'master') {
|
||||
var contentPath = 'https://raw.githubusercontent.com/' + repoId + `/${version}/` + repoPath;
|
||||
console.log('Reading from ' + contentPath);
|
||||
return download(contentPath).then(function (content) {
|
||||
var ext = path.extname(repoPath);
|
||||
|
|
|
@ -20,5 +20,6 @@ function adaptInjectionScope(grammar) {
|
|||
injections[newInjectionKey] = injection;
|
||||
}
|
||||
|
||||
updateGrammar.update('atom/language-php', 'grammars/php.cson', './syntaxes/php.tmLanguage.json', adaptInjectionScope);
|
||||
updateGrammar.update('atom/language-php', 'grammars/php.cson', './syntaxes/php.tmLanguage.json', undefined);
|
||||
updateGrammar.update('atom/language-php', 'grammars/html.cson', './syntaxes/html.tmLanguage.json', adaptInjectionScope);
|
||||
|
||||
|
|
|
@ -35,10 +35,15 @@
|
|||
}
|
||||
],
|
||||
"grammars": [
|
||||
{
|
||||
"language": "php",
|
||||
"scopeName": "source.php",
|
||||
"path": "./syntaxes/php.tmLanguage.json"
|
||||
},
|
||||
{
|
||||
"language": "php",
|
||||
"scopeName": "text.html.php",
|
||||
"path": "./syntaxes/php.tmLanguage.json",
|
||||
"path": "./syntaxes/html.tmLanguage.json",
|
||||
"embeddedLanguages": {
|
||||
"text.html": "html",
|
||||
"source.php": "php",
|
||||
|
|
106
extensions/php/syntaxes/html.tmLanguage.json
Normal file
106
extensions/php/syntaxes/html.tmLanguage.json
Normal file
|
@ -0,0 +1,106 @@
|
|||
{
|
||||
"information_for_contributors": [
|
||||
"This file has been converted from https://github.com/atom/language-php/blob/master/grammars/html.cson",
|
||||
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
|
||||
"Once accepted there, we are happy to receive an update request."
|
||||
],
|
||||
"version": "https://github.com/atom/language-php/commit/29c140e1531e0b5e842e5bfd4377f879d8b79cd4",
|
||||
"scopeName": "text.html.php",
|
||||
"name": "PHP",
|
||||
"fileTypes": [
|
||||
"aw",
|
||||
"ctp",
|
||||
"inc",
|
||||
"install",
|
||||
"module",
|
||||
"php",
|
||||
"php_cs",
|
||||
"php3",
|
||||
"php4",
|
||||
"php5",
|
||||
"phpt",
|
||||
"phtml",
|
||||
"profile"
|
||||
],
|
||||
"firstLineMatch": "(?x)\n# Hashbang\n^\\#!.*(?:\\s|\\/)\n php\\d?\n(?:$|\\s)\n|\n# Modeline\n(?i:\n # Emacs\n -\\*-(?:\\s*(?=[^:;\\s]+\\s*-\\*-)|(?:.*?[;\\s]|(?<=-\\*-))mode\\s*:\\s*)\n php\n (?=[\\s;]|(?<![-*])-\\*-).*?-\\*-\n |\n # Vim\n (?:(?:\\s|^)vi(?:m[<=>]?\\d+|m)?|\\sex)(?=:(?=\\s*set?\\s[^\\n:]+:)|:(?!\\s*set?\\s))(?:(?:\\s|\\s*:\\s*)\\w*(?:\\s*=(?:[^\\n\\\\\\s]|\\\\.)*)?)*[\\s:](?:filetype|ft|syntax)\\s*=\n (?:php|phtml)\n (?=\\s|:|$)\n)\n|\n# Regular opening PHP tags\n^\\s*<\\?(?i:php|=|\\s|$)",
|
||||
"foldingStartMarker": "(/\\*|\\{\\s*$|<<<HTML)",
|
||||
"foldingStopMarker": "(\\*/|^\\s*\\}|^HTML;)",
|
||||
"injections": {
|
||||
"text.html.php - (meta.embedded | meta.tag), L:text.html.php meta.tag, L:text.html.php source.js": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#php-tag"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"begin": "\\A#!",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.comment.php"
|
||||
}
|
||||
},
|
||||
"end": "$",
|
||||
"name": "comment.line.shebang.php"
|
||||
},
|
||||
{
|
||||
"include": "text.html.basic"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"php-tag": {
|
||||
"patterns": [
|
||||
{
|
||||
"begin": "<\\?(?i:php|=)?(?![^?]*\\?>)",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.section.embedded.begin.php"
|
||||
}
|
||||
},
|
||||
"end": "(\\?)>",
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.section.embedded.end.php"
|
||||
},
|
||||
"1": {
|
||||
"name": "source.php"
|
||||
}
|
||||
},
|
||||
"name": "meta.embedded.block.php",
|
||||
"contentName": "source.php",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "source.php"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"begin": "<\\?(?i:php|=)?",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.section.embedded.begin.php"
|
||||
}
|
||||
},
|
||||
"end": "(\\?)>",
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.section.embedded.end.php"
|
||||
},
|
||||
"1": {
|
||||
"name": "source.php"
|
||||
}
|
||||
},
|
||||
"name": "meta.embedded.line.php",
|
||||
"contentName": "source.php",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "source.php"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue