Merge pull request #148 from msftrncs/ScopeSubst#147
Make scope capture substitution regex global
This commit is contained in:
Коммит
4fefcf317e
|
@ -54,7 +54,7 @@ export function basename(path: string): string {
|
|||
}
|
||||
}
|
||||
|
||||
let CAPTURING_REGEX_SOURCE = /\$(\d+)|\${(\d+):\/(downcase|upcase)}/;
|
||||
let CAPTURING_REGEX_SOURCE = /\$(\d+)|\${(\d+):\/(downcase|upcase)}/g;
|
||||
|
||||
export class RegexSource {
|
||||
|
||||
|
@ -62,6 +62,7 @@ export class RegexSource {
|
|||
if (regexSource === null) {
|
||||
return false;
|
||||
}
|
||||
CAPTURING_REGEX_SOURCE.lastIndex = 0;
|
||||
return CAPTURING_REGEX_SOURCE.test(regexSource);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"scopeName": "source.test",
|
||||
"patterns": [
|
||||
{
|
||||
"match": "\\b(?i:function)\\b",
|
||||
"name": "storage.type.$0 keyword.declaration.$0"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1806,5 +1806,27 @@
|
|||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"grammars": [
|
||||
"fixtures/147.grammar.json"
|
||||
],
|
||||
"grammarPath": "fixtures/147.grammar.json",
|
||||
"desc": "Issue #147",
|
||||
"lines": [
|
||||
{
|
||||
"line": "Function",
|
||||
"tokens": [
|
||||
{
|
||||
"value": "Function",
|
||||
"scopes": [
|
||||
"source.test",
|
||||
"storage.type.Function",
|
||||
"keyword.declaration.Function"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
Загрузка…
Ссылка в новой задаче