mirror of
https://github.com/microsoft/vscode.git
synced 2026-02-21 02:11:11 +00:00
Update js/ts grammar
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
"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/Microsoft/TypeScript-TmLanguage/commit/3a70fab1b03520774fa236f1f7e7a0939463739f",
|
||||
"version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/9be58bc51f179fd4119dbd5caaa7693a381a13b5",
|
||||
"name": "JavaScript (with React support)",
|
||||
"scopeName": "source.js",
|
||||
"fileTypes": [
|
||||
@@ -203,7 +203,7 @@
|
||||
"include": "#comment"
|
||||
},
|
||||
{
|
||||
"begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*)|(\\'[^']*\\')|(\\\"[^\"]*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(:))",
|
||||
"begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*)|(\\'.*\\')|(\\\".*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(:))",
|
||||
"end": "(?=,|\\})",
|
||||
"patterns": [
|
||||
{
|
||||
@@ -229,7 +229,7 @@
|
||||
]
|
||||
},
|
||||
"object-binding-element-propertyName": {
|
||||
"begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*)|(\\'[^']*\\')|(\\\"[^\"]*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(:))",
|
||||
"begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*)|(\\'.*\\')|(\\\".*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(:))",
|
||||
"end": "(:)",
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
@@ -586,7 +586,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"begin": "(?=((\\'[^']*\\')|(\\\"[^\"]*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\])))",
|
||||
"begin": "(?=((\\'.*\\')|(\\\".*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\])))",
|
||||
"end": "(?=,|\\}|$)",
|
||||
"patterns": [
|
||||
{
|
||||
@@ -1141,20 +1141,20 @@
|
||||
},
|
||||
"field-declaration": {
|
||||
"name": "meta.field.declaration.js",
|
||||
"begin": "(?<!\\()(?:(?<!\\.|\\$)\\b(readonly)\\s+)?(?=(([_$[:alpha:]][_$[:alnum:]]*)|(\\'[^']*\\')|(\\\"[^\"]*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\?\\s*)?(=|:))",
|
||||
"begin": "(?<!\\()(?:(?<!\\.|\\$)\\b(readonly)\\s+)?(?=(([_$[:alpha:]][_$[:alnum:]]*)|(\\'.*\\')|(\\\".*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\?\\s*)?(=|:))",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "storage.modifier.js"
|
||||
}
|
||||
},
|
||||
"end": "(?=\\}|;|,|$|(^(?!(([_$[:alpha:]][_$[:alnum:]]*)|(\\'[^']*\\')|(\\\"[^\"]*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\?\\s*)?(=|:))))|(?<=\\})",
|
||||
"end": "(?=\\}|;|,|$|(^(?!(([_$[:alpha:]][_$[:alnum:]]*)|(\\'.*\\')|(\\\".*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\?\\s*)?(=|:))))|(?<=\\})",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#variable-initializer"
|
||||
},
|
||||
{
|
||||
"begin": "(?=((?:[_$[:alpha:]][_$[:alnum:]]*)|(?:\\'[^']*\\')|(?:\\\"[^\"]*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\?\\s*)?(=|:))",
|
||||
"end": "(?=[};,=]|$|(^(?!(([_$[:alpha:]][_$[:alnum:]]*)|(\\'[^']*\\')|(\\\"[^\"]*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\?\\s*)?(=|:))))|(?<=\\})",
|
||||
"begin": "(?=((?:[_$[:alpha:]][_$[:alnum:]]*)|(?:\\'.*\\')|(?:\\\".*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\?\\s*)?(=|:))",
|
||||
"end": "(?=[};,=]|$|(^(?!(([_$[:alpha:]][_$[:alnum:]]*)|(\\'.*\\')|(\\\".*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\?\\s*)?(=|:))))|(?<=\\})",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#type-annotation"
|
||||
@@ -1188,7 +1188,7 @@
|
||||
"patterns": [
|
||||
{
|
||||
"name": "meta.method.declaration.js",
|
||||
"begin": "(?<!\\.|\\$)(?:\\b(public|private|protected)\\s+)?(?:\\b(abstract)\\s+)?(?:\\b(async)\\s+)?(?:\\b(get|set)\\s+)(?:(\\*)\\s*)?(?=((([_$[:alpha:]][_$[:alnum:]]*)|(\\'[^']*\\')|(\\\"[^\"]*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\??))\\s*[\\(\\<])",
|
||||
"begin": "(?<!\\.|\\$)(?:\\b(public|private|protected)\\s+)?(?:\\b(abstract)\\s+)?(?:\\b(async)\\s+)?(?:\\b(get|set)\\s+)(?:(\\*)\\s*)?(?=((([_$[:alpha:]][_$[:alnum:]]*)|(\\'.*\\')|(\\\".*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\??))\\s*[\\(\\<])",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "storage.modifier.js"
|
||||
@@ -1230,7 +1230,7 @@
|
||||
},
|
||||
{
|
||||
"name": "meta.method.declaration.js",
|
||||
"begin": "(?<!\\.|\\$)(?:\\b(public|private|protected)\\s+)?(?:\\b(abstract)\\s+)?(?:\\b(async)\\s+)?(?:(?:\\b(?:(new)|(constructor))\\b(?!\\$|\\.|:))|(?:(\\*)\\s*)?(?=((([_$[:alpha:]][_$[:alnum:]]*)|(\\'[^']*\\')|(\\\"[^\"]*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\??))?\\s*[\\(\\<]))",
|
||||
"begin": "(?<!\\.|\\$)(?:\\b(public|private|protected)\\s+)?(?:\\b(abstract)\\s+)?(?:\\b(async)\\s+)?(?:(?:\\b(?:(new)|(constructor))\\b(?!\\$|\\.|:))|(?:(\\*)\\s*)?(?=((([_$[:alpha:]][_$[:alnum:]]*)|(\\'.*\\')|(\\\".*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\??))?\\s*[\\(\\<]))",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "storage.modifier.js"
|
||||
@@ -1276,7 +1276,7 @@
|
||||
]
|
||||
},
|
||||
"method-declaration-name": {
|
||||
"begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*)|(\\'[^']*\\')|(\\\"[^\"]*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\??)\\s*[\\(\\<])",
|
||||
"begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*)|(\\'.*\\')|(\\\".*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\??)\\s*[\\(\\<])",
|
||||
"end": "(?=\\(|\\<)",
|
||||
"patterns": [
|
||||
{
|
||||
@@ -1297,7 +1297,7 @@
|
||||
},
|
||||
"object-literal-method-declaration": {
|
||||
"name": "meta.method.declaration.js",
|
||||
"begin": "(?<!\\.|\\$)(?:\\b(async)\\s+)?(?:\\b(get|set)\\s+)?(?:(\\*)\\s*)?(?=((([_$[:alpha:]][_$[:alnum:]]*)|(\\'[^']*\\')|(\\\"[^\"]*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\??))\\s*[\\(\\<])",
|
||||
"begin": "(?<!\\.|\\$)(?:\\b(async)\\s+)?(?:\\b(get|set)\\s+)?(?:(\\*)\\s*)?(?=((([_$[:alpha:]][_$[:alnum:]]*)|(\\'.*\\')|(\\\".*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\??))\\s*[\\(\\<])",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "storage.modifier.async.js"
|
||||
@@ -1335,7 +1335,7 @@
|
||||
]
|
||||
},
|
||||
"object-literal-method-overload-declaration": {
|
||||
"begin": "(?<!\\.|\\$)(?:\\b(async)\\s+)?(?:\\b(get|set)\\s+)?(?:(\\*)\\s*)?(?=((([_$[:alpha:]][_$[:alnum:]]*)|(\\'[^']*\\')|(\\\"[^\"]*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\??))\\s*[\\(\\<])",
|
||||
"begin": "(?<!\\.|\\$)(?:\\b(async)\\s+)?(?:\\b(get|set)\\s+)?(?:(\\*)\\s*)?(?=((([_$[:alpha:]][_$[:alnum:]]*)|(\\'.*\\')|(\\\".*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\??))\\s*[\\(\\<])",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "storage.modifier.async.js"
|
||||
@@ -1655,7 +1655,7 @@
|
||||
"include": "#comment"
|
||||
},
|
||||
{
|
||||
"begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*)|(\\'[^']*\\')|(\\\"[^\"]*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(:))",
|
||||
"begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*)|(\\'.*\\')|(\\\".*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(:))",
|
||||
"end": "(?=,|\\})",
|
||||
"patterns": [
|
||||
{
|
||||
@@ -1758,20 +1758,46 @@
|
||||
]
|
||||
},
|
||||
"return-type": {
|
||||
"name": "meta.return.type.js",
|
||||
"begin": "(?<=\\))\\s*(:)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "keyword.operator.type.annotation.js"
|
||||
"patterns": [
|
||||
{
|
||||
"name": "meta.return.type.js",
|
||||
"begin": "(?<=\\))\\s*(:)(?=\\s*\\S)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "keyword.operator.type.annotation.js"
|
||||
}
|
||||
},
|
||||
"end": "(?<![:|&])(?=$|^|[{};,]|//)",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#return-type-core"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "meta.return.type.js",
|
||||
"begin": "(?<=\\))\\s*(:)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "keyword.operator.type.annotation.js"
|
||||
}
|
||||
},
|
||||
"end": "(?<![:|&])((?=[{};,]|//|^\\s*$)|((?<=\\S)(?=\\s*$)))",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#return-type-core"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"end": "(?<![:|&])(?=$|^|[{};,]|//)",
|
||||
]
|
||||
},
|
||||
"return-type-core": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#comment"
|
||||
},
|
||||
{
|
||||
"begin": "(?<=[:])(?=\\s*\\{)",
|
||||
"begin": "(?<=[:|&])(?=\\s*\\{)",
|
||||
"end": "(?<=\\})",
|
||||
"patterns": [
|
||||
{
|
||||
@@ -1792,20 +1818,36 @@
|
||||
"match": "(?<!\\.|\\$)\\bis\\b(?!\\$|\\.)"
|
||||
},
|
||||
"type-annotation": {
|
||||
"name": "meta.type.annotation.js",
|
||||
"begin": ":",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "keyword.operator.type.annotation.js"
|
||||
}
|
||||
},
|
||||
"end": "(?=$|^|[,);\\}\\]]|//)|(?==[^>])|(?<=[\\}>\\]\\)]|[_$[:alpha:]])\\s*(?=\\{)",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#comment"
|
||||
"name": "meta.type.annotation.js",
|
||||
"begin": "(:)(?=\\s*\\S)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "keyword.operator.type.annotation.js"
|
||||
}
|
||||
},
|
||||
"end": "(?<![:|&])((?=$|^|[,);\\}\\]]|//)|(?==[^>])|((?<=[\\}>\\]\\)]|[_$[:alpha:]])\\s*(?=\\{)))",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#type"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"include": "#type"
|
||||
"name": "meta.type.annotation.js",
|
||||
"begin": "(:)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "keyword.operator.type.annotation.js"
|
||||
}
|
||||
},
|
||||
"end": "(?<![:|&])((?=[,);\\}\\]]|//)|(?==[^>])|(?=^\\s*$)|((?<=\\S)(?=\\s*$))|((?<=[\\}>\\]\\)]|[_$[:alpha:]])\\s*(?=\\{)))",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#type"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1995,14 +2037,40 @@
|
||||
]
|
||||
},
|
||||
"type-function-return-type": {
|
||||
"name": "meta.type.function.return.js",
|
||||
"begin": "=>",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "storage.type.function.arrow.js"
|
||||
"patterns": [
|
||||
{
|
||||
"name": "meta.type.function.return.js",
|
||||
"begin": "(=>)(?=\\s*\\S)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "storage.type.function.arrow.js"
|
||||
}
|
||||
},
|
||||
"end": "(?<!=>)(?<![|&])(?=[,\\]\\)\\{\\}=;>]|//|$)",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#type-function-return-type-core"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "meta.type.function.return.js",
|
||||
"begin": "=>",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "storage.type.function.arrow.js"
|
||||
}
|
||||
},
|
||||
"end": "(?<!=>)(?<![|&])((?=[,\\]\\)\\{\\}=;>]|//|^\\s*$)|((?<=\\S)(?=\\s*$)))",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#type-function-return-type-core"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"end": "(?<!=>)(?<![|&])(?=[,\\]\\)\\{\\}=;>]|//|$)",
|
||||
]
|
||||
},
|
||||
"type-function-return-type-core": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#comment"
|
||||
@@ -2123,7 +2191,7 @@
|
||||
"name": "keyword.operator.assignment.js"
|
||||
}
|
||||
},
|
||||
"end": "(?=[,);}\\]])|(?=^\\s*$)|(?<=\\S)(?<!=)",
|
||||
"end": "(?=[,);}\\]])|(?=^\\s*$)|(?<=\\S)(?<!=)(?=\\s*$)",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#expression"
|
||||
@@ -2426,6 +2494,10 @@
|
||||
{
|
||||
"include": "#punctuation-accessor"
|
||||
},
|
||||
{
|
||||
"name": "keyword.operator.expression.import.js",
|
||||
"match": "(?![\\.\\$])\\bimport(?=\\s*[\\(]\\s*[\\\"\\'\\`])"
|
||||
},
|
||||
{
|
||||
"name": "entity.name.function.js",
|
||||
"match": "([_$[:alpha:]][_$[:alnum:]]*)"
|
||||
@@ -2582,12 +2654,12 @@
|
||||
},
|
||||
{
|
||||
"name": "meta.object.member.js",
|
||||
"begin": "(?=(?:(?:\\'[^']*\\')|(?:\\\"[^\"]*\\\")|(?:\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*:)",
|
||||
"begin": "(?=(?:(?:\\'.*\\')|(?:\\\".*\\\")|(?:\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*:)",
|
||||
"end": "(?=,|\\})",
|
||||
"patterns": [
|
||||
{
|
||||
"name": "meta.object-literal.key.js",
|
||||
"begin": "(?=(?:(?:\\'[^']*\\')|(?:\\\"[^\"]*\\\")|(?:\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*:)",
|
||||
"begin": "(?=(?:(?:\\'.*\\')|(?:\\\".*\\\")|(?:\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*:)",
|
||||
"end": ":",
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
@@ -3429,7 +3501,7 @@
|
||||
},
|
||||
"directives": {
|
||||
"name": "comment.line.triple-slash.directive.js",
|
||||
"begin": "^(///)\\s*(?=<(reference|amd-dependency|amd-module)(\\s+(path|types|no-default-lib|name)\\s*=\\s*((\\'[^']*\\')|(\\\"[^\"]*\\\")))+\\s*/>\\s*$)",
|
||||
"begin": "^(///)\\s*(?=<(reference|amd-dependency|amd-module)(\\s+(path|types|no-default-lib|name)\\s*=\\s*((\\'.*\\')|(\\\".*\\\")))+\\s*/>\\s*$)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.comment.js"
|
||||
|
||||
Reference in New Issue
Block a user