Skip to content

Commit 9eaa872

Browse files
committed
Update regexp injection
1 parent 253387b commit 9eaa872

4 files changed

Lines changed: 88 additions & 11 deletions

File tree

syntaxes/package-when.tmLanguage.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/RedCMD/TmLanguage-Syntax-Highlighter/main/vscode.tmLanguage.schema.json",
3-
"name": "\"when\" & \"enablement\" inside package.json and keybingings.json",
3+
"name": "\"when\" & \"enablement\" inside package.json and keybindings.json",
44
"comment": "https://code.visualstudio.com/api/references/when-clause-contexts",
55
"scopeName": "source.json.package.when",
66
"injectionSelector": [
@@ -144,7 +144,7 @@
144144
},
145145
"regexp": {
146146
"begin": "(\\\\)?(/)",
147-
"end": "(\\\\)?(/)([igsmyu]*)|(?=\")|$",
147+
"end": "(\\\\)?(/)([gimsuy]*)|(?=\")|$",
148148
"beginCaptures": {
149149
"1": { "name": "constant.character.escape.regexp.json" },
150150
"2": { "name": "punctuation.definition.string.begin.when.json" }

syntaxes/regexp.tmLanguage.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
"L:source.json.embedded .meta.embedded.contributes. .meta.embedded.problemMatchers. meta.structure.array.json .meta.embedded.pattern. .meta.embedded.regexp. string.quoted.double.json -(meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json) -(meta.structure.array.json meta.structure.array.json) -meta.embedded.json.regexp -comment",
1313
"L:source.json.embedded .meta.embedded.contributes. .meta.embedded.problemPatterns. meta.structure.array.json .meta.embedded.patterns. meta.structure.array.json .meta.embedded.regexp. string.quoted.double.json -(meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json) -(meta.structure.array.json meta.structure.array.json meta.structure.array.json) -meta.embedded.json.regexp -comment",
1414
"L:source.json.embedded .meta.embedded.contributes. .meta.embedded.problemPatterns. meta.structure.array.json .meta.embedded.regexp. string.quoted.double.json -(meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json) -(meta.structure.array.json meta.structure.array.json) -meta.embedded.json.regexp -comment",
15-
"L:source.json.comments.embedded .meta.embedded.wordPattern. (.meta.embedded.pattern. -(meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments) | -(meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments)) meta.structure.dictionary.value.json.comments string.quoted.double.json.comments -meta.structure.array.json.comments -meta.embedded.json.regexp -comment",
16-
"L:source.json.comments.embedded .meta.embedded.folding. .meta.embedded.markers. (.meta.embedded.start. | .meta.embedded.end.) meta.structure.dictionary.value.json.comments string.quoted.double.json.comments -(meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments) -meta.structure.array.json.comments -meta.embedded.json.regexp -comment",
17-
"L:source.json.comments.embedded .meta.embedded.onEnterRules. meta.structure.array.json.comments (.meta.embedded.afterText. | .meta.embedded.beforeText. | .meta.embedded.previousLineText.) (.meta.embedded.pattern. -(meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments) | -(meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments)) meta.structure.dictionary.value.json.comments string.quoted.double.json.comments -(meta.structure.array.json.comments meta.structure.array.json.comments) -meta.embedded.json.regexp -comment",
18-
"L:source.json.comments.embedded .meta.embedded.indentationRules. (.meta.embedded.decreaseIndentPattern. | .meta.embedded.increaseIndentPattern. | .meta.embedded.unIndentedLinePattern. | .meta.embedded.indentNextLinePattern.) (.meta.embedded.pattern. -(meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments) | -(meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments)) meta.structure.dictionary.value.json.comments string.quoted.double.json.comments -meta.structure.array.json.comments -meta.embedded.json.regexp -comment",
15+
"L:source.json.comments.embedded .meta.embedded.wordPattern. (.meta.embedded.pattern. -(meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments) | -(meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments)) string.quoted.double.json.comments -meta.structure.array.json.comments -meta.embedded.json.regexp -comment",
16+
"L:source.json.comments.embedded .meta.embedded.folding. .meta.embedded.markers. (.meta.embedded.start. | .meta.embedded.end.) string.quoted.double.json.comments -(meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments) -meta.structure.array.json.comments -meta.embedded.json.regexp -comment",
17+
"L:source.json.comments.embedded .meta.embedded.onEnterRules. meta.structure.array.json.comments (.meta.embedded.afterText. | .meta.embedded.beforeText. | .meta.embedded.previousLineText.) (.meta.embedded.pattern. -(meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments) | -(meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments)) string.quoted.double.json.comments -(meta.structure.array.json.comments meta.structure.array.json.comments) -meta.embedded.json.regexp -comment",
18+
"L:source.json.comments.embedded .meta.embedded.indentationRules. (.meta.embedded.decreaseIndentPattern. | .meta.embedded.increaseIndentPattern. | .meta.embedded.unIndentedLinePattern. | .meta.embedded.indentNextLinePattern.) (.meta.embedded.pattern. -(meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments) | -(meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments)) string.quoted.double.json.comments -meta.structure.array.json.comments -meta.embedded.json.regexp -comment",
1919
"L:source.json.comments.embedded .meta.embedded.tasks. meta.structure.array.json.comments .meta.embedded.problemMatcher. .meta.embedded.background. (.meta.embedded.beginsPattern. | .meta.embedded.endsPattern.) (string.quoted.double.json.comments -(meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments) | .meta.embedded.regexp. string.quoted.double.json.comments -(meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments)) -(meta.structure.array.json.comments meta.structure.array.json.comments meta.structure.array.json.comments) -meta.embedded.json.regexp -comment",
2020
"L:source.json.comments.embedded .meta.embedded.tasks. meta.structure.array.json.comments .meta.embedded.problemMatcher. .meta.embedded.pattern. meta.structure.array.json.comments .meta.embedded.regexp. string.quoted.double.json.comments -(meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments) -(meta.structure.array.json.comments meta.structure.array.json.comments meta.structure.array.json.comments meta.structure.array.json.comments) -meta.embedded.json.regexp -comment",
2121
"L:source.json.comments.embedded .meta.embedded.tasks. meta.structure.array.json.comments .meta.embedded.problemMatcher. .meta.embedded.pattern. .meta.embedded.regexp. string.quoted.double.json.comments -(meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments) -(meta.structure.array.json.comments meta.structure.array.json.comments meta.structure.array.json.comments) -meta.embedded.json.regexp -comment",
@@ -53,7 +53,7 @@
5353
"name": "keyword.other.back-reference.regexp.json",
5454
"patterns": [
5555
{
56-
"match": "[$A-Z_a-z][$0-9A-Z_a-z]*",
56+
"match": "[$_[:alpha:]][$_[:alnum:]]*",
5757
"name": "variable.other.regexp.json"
5858
},
5959
{ "include": "source.json.embedded#stringcontent" }
@@ -92,7 +92,7 @@
9292
"patterns": [ { "include": "#regexp" } ]
9393
},
9494
{
95-
"begin": "\\((?>(\\?([ims-]*):)|\\?<([a-zA-Z_$][\\w$]*)>)?",
95+
"begin": "\\((?>(\\?([-ims]*):)|\\?<([$_[:alpha:]][$_[:alnum:]]*)>)?",
9696
"end": "\\)|(?=\")|$",
9797
"beginCaptures": {
9898
"0": { "name": "punctuation.definition.group.regexp.json" },
@@ -125,7 +125,7 @@
125125
"name": "variable.other.constant.character-class.range.regexp.json"
126126
},
127127
{
128-
"match": "(?:(\\\\{2}(?>[0-7]{3}|x\\h{2}|u\\h{4}))|(\\\\{2}c[A-Z])|(\\\\{4}|\\\\{1,2}[^\\\\wWsSdD])|.)-(?:(\\\\{2}(?:[0-7]{3}|x\\h{2}|u\\h{4}))|(\\\\{2}c[A-Z])|(\\\\{4}|\\\\{1,2}[^\\\\wWsSdD])|[^]])",
128+
"match": "(?:(\\\\{2}(?>[0-7]{3}|x\\h{2}|u\\h{4}))|(\\\\{2}c[A-Z])|(\\\\{4}|\\\\{1,2}[^\\\\wWsSdD])|.)-(?:(\\\\{2}(?:[0-7]{3}|x\\h{2}|u\\h{4}))|(\\\\{2}c[A-Z])|(\\\\{4}|\\\\{1,2}[^\\\\wWsSdD])|[^]\"])",
129129
"captures": {
130130
"0": { "name": "support.class.range.regex.json" },
131131
"1": { "name": "constant.character.numeric.regexp.json" },
@@ -154,11 +154,11 @@
154154
"name": "constant.character.class.regexp.json"
155155
},
156156
{
157-
"match": "\\\\{2}[trnvfb0]",
157+
"match": "\\\\{2}[0bfnrtv]",
158158
"name": "constant.character.escape.character.regexp.json"
159159
},
160160
{
161-
"match": "\\\\{2}c[A-Z]",
161+
"match": "\\\\{2}c[A-Za-z]",
162162
"name": "constant.character.control.regexp.json"
163163
},
164164
{

syntaxes/tests/JSONC/keybindings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
[
2+
{
3+
"when": "regex =~ /flags/igsmyu && controlCharacters =~ /\\cA\\ca\\cM\\cm\\cJ\\cj\\cZ\\cz \\c@\\c*/ || escapeChars =~ /\\0\\b\\f\\n\\r\\t\\v/ && alpha =~ /ÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒ/"
4+
},
25
{
36
"key": "enter",
47
"command": "-magit.visit-at-point",

0 commit comments

Comments
 (0)