Skip to content

Commit e7a886c

Browse files
committed
Improve SQL test query injection
1 parent a0859de commit e7a886c

File tree

1 file changed

+14
-23
lines changed

1 file changed

+14
-23
lines changed

syntaxes/test.query.sql.tmLanguage.json

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,26 @@
33
"comment": "https://github.com/omnigres/omnigres/blob/master/pg_yregress/schema.json#L190",
44
"name": "json.query",
55
"scopeName": "source.json.sql",
6-
"injectionSelector": "L:source.json .meta.embedded.test. .meta.embedded.query. meta.structure.dictionary.value.json -(meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json) -meta.structure.array.json -string -comment",
6+
"injectionSelector": "L:source.json .meta.embedded.test. .meta.embedded.query. string.quoted.double.json -(meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json) -meta.structure.array.json -meta.embedded.sql.json -comment -source.json.comments",
77
"patterns": [
8+
{
9+
"comment": "https://github.com/microsoft/vscode-textmate/issues/242",
10+
"include": "source.sql#_pre-load_"
11+
},
812
{ "include": "#query" }
913
],
1014
"repository": {
1115
"query": {
12-
"patterns": [
13-
{
14-
"comment": "VSCode TextMate bug. For some reason, including a grammar from within a capture group doesn't load the include. We have to pre-load the include outside of a capture group. https://github.com/microsoft/vscode-textmate/issues/242",
15-
"begin": "(*FAIL)",
16-
"end": "|",
17-
"patterns": [ { "include": "source.sql" } ]
18-
},
19-
{
20-
"match": "(\")((?>[^\\\\\"]++|\\\\.)++)(\")",
21-
"captures": {
22-
"0": { "name": "string.quoted.double.json" },
23-
"1": { "name": "punctuation.definition.string.begin.json" },
24-
"2": {
25-
"name": "meta.embedded.sql.json",
26-
"patterns": [
27-
{ "include": "source.sql" },
28-
{ "include": "source.json#stringcontent" }
29-
]
30-
},
31-
"3": { "name": "punctuation.definition.string.end.json" }
32-
}
16+
"match": "\\G(?>[^\\\\\"\\x-\\x1F]++|\\\\.)++",
17+
"captures": {
18+
"0": {
19+
"name": "meta.embedded.sql.json",
20+
"patterns": [
21+
{ "include": "source.sql" },
22+
{ "include": "source.json#stringcontent" }
23+
]
3324
}
34-
]
25+
}
3526
}
3627
}
3728
}

0 commit comments

Comments
 (0)