Skip to content

Commit 82eafdb

Browse files
committed
feat: Additions to shellScript
1 parent fc0811f commit 82eafdb

11 files changed

+588
-9
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,15 @@
6363
"meta.embedded.shellscript": "shellscript"
6464
},
6565
"injectTo": [
66+
"source.json.comments.embedded",
6667
"source.json.embedded"
6768
]
6869
},
6970
{
7071
"scopeName": "source.json.shellscript.escaped",
7172
"path": "./syntaxes/shellscript-escaped.tmLanguage.json",
7273
"injectTo": [
74+
"source.json.comments.embedded",
7375
"source.json.embedded"
7476
]
7577
},

syntaxes/shellscript-escaped.tmLanguage.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
"comment": "Double quotes requiring escaping when embedded inside JSON",
44
"name": "JSON Escaped ShellScript Strings",
55
"scopeName": "source.json.shellscript.escaped",
6-
"injectionSelector": "L:source.json.embedded meta.embedded.shellscript.json -string.quoted.double.shell",
6+
"injectionSelector": [
7+
"L:source.json.embedded meta.embedded.shellscript.json -string.quoted.double.shell",
8+
"L:source.json.comments.embedded meta.embedded.shellscript.json -string.quoted.double.shell"
9+
],
710
"patterns": [
811
{ "include": "#string" }
912
],

syntaxes/shellscript.tmLanguage.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@
33
"comment": "\"scripts\" in `package.json` and \"command\" in `tasks.json`",
44
"name": "JSON Embedded ShellScript",
55
"scopeName": "source.json.shellscript",
6-
"injectionSelector": "L:source.json.embedded .meta.scripts. meta.structure.dictionary.json string.quoted.double.json\n-meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json\n-meta.structure.array.json\n-meta.embedded.shellscript.json -comment",
6+
"injectionSelector": [
7+
"L:source.json.embedded .meta.scripts. meta.structure.dictionary.json string.quoted.double.json\n-meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json\n-meta.structure.array.json\n-meta.embedded.shellscript.json -comment",
8+
"L:source.json.comments.embedded .meta.tasks. meta.structure.array.json.comments .meta.command. string.quoted.double.json.comments\n-meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments\n-meta.structure.array.json.comments meta.structure.array.json.comments meta.structure.array.json.comments\n-meta.structure.array.json.comments meta.structure.array.json.comments .meta.command.\n-meta.embedded.json.regexp -comment",
9+
"L:source.json.comments.embedded .meta.tasks. meta.structure.array.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments .meta.command. string.quoted.double.json.comments\n(.meta.windows. | .meta.linux. | .meta.osx.)\n-meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments\n-meta.structure.array.json.comments meta.structure.array.json.comments meta.structure.array.json.comments\n-meta.structure.array.json.comments meta.structure.array.json.comments .meta.command.\n-meta.embedded.json.regexp -comment",
10+
"L:source.json.comments.embedded .meta.tasks. .meta.tasks. meta.structure.array.json.comments .meta.command. string.quoted.double.json.comments\n-meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments\n-meta.structure.array.json.comments meta.structure.array.json.comments meta.structure.array.json.comments\n-meta.structure.array.json.comments meta.structure.array.json.comments .meta.command.\n-meta.embedded.json.regexp -comment",
11+
"L:source.json.comments.embedded .meta.tasks. .meta.tasks. meta.structure.array.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments .meta.command. string.quoted.double.json.comments\n(.meta.windows. | .meta.linux. | .meta.osx.)\n-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\n-meta.structure.array.json.comments meta.structure.array.json.comments meta.structure.array.json.comments\n-meta.structure.array.json.comments meta.structure.array.json.comments .meta.command.\n-meta.embedded.json.regexp -comment",
12+
"L:source.json.comments.embedded .meta.mcp. .meta.servers. meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments .meta.command. string.quoted.double.json.comments\n-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\n-meta.structure.array.json.comments\n-meta.embedded.json.regexp -comment",
13+
"L:source.json.comments.embedded .meta.launch. .meta.configurations. meta.structure.array.json.comments .meta.command. string.quoted.double.json.comments\n-meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments\n-meta.structure.array.json.comments meta.structure.array.json.comments\n-meta.embedded.json.regexp -comment"
14+
],
715
"patterns": [
816
{
917
"comment": "https://github.com/microsoft/vscode-textmate/issues/242",

syntaxes/tests/JSON/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
],
2929
"scripts": {
3030
"build": "npm run compile && npm run compile-web && npm run generate-wasm && node ./out/Onigmo/moveOnigmo",
31-
"package": "vsce package",
31+
"package": "vsce package $\"escape \\\\ \\\" \\$ \\` $@ string\"",
3232
"watch": "tsc -watch -p ./",
3333
"watch-web": "webpack --watch",
3434
"compile": "tsc -p ./",

syntaxes/tests/JSON/package.json.snap

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@
277277
# ^^^^^^^^^^^^^^^^^^^^^^^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.build. meta.structure.dictionary.value.json string.quoted.double.json meta.embedded.shellscript.json meta.statement.shell meta.statement.command.shell meta.argument.shell string.unquoted.argument.shell
278278
# ^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.build. meta.structure.dictionary.value.json string.quoted.double.json punctuation.definition.string.end.json
279279
# ^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.build. meta.structure.dictionary.value.json punctuation.separator.dictionary.pair.json
280-
> "package": "vsce package",
280+
> "package": "vsce package $\"escape \\\\ \\\" \\$ \\` $@ string\"",
281281
#^^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json
282282
# ^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. string.json support.type.property-name.json punctuation.support.type.property-name.begin.json
283283
# ^^^^^^^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. string.json support.type.property-name.json
@@ -288,8 +288,24 @@
288288
# ^^^^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. meta.structure.dictionary.value.json string.quoted.double.json meta.embedded.shellscript.json meta.statement.shell meta.statement.command.shell meta.statement.command.name.shell entity.name.function.call.shell entity.name.command.shell
289289
# ^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. meta.structure.dictionary.value.json string.quoted.double.json meta.embedded.shellscript.json meta.statement.shell meta.statement.command.shell meta.argument.shell
290290
# ^^^^^^^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. meta.structure.dictionary.value.json string.quoted.double.json meta.embedded.shellscript.json meta.statement.shell meta.statement.command.shell meta.argument.shell string.unquoted.argument.shell
291-
# ^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. meta.structure.dictionary.value.json string.quoted.double.json punctuation.definition.string.end.json
292-
# ^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. meta.structure.dictionary.value.json punctuation.separator.dictionary.pair.json
291+
# ^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. meta.structure.dictionary.value.json string.quoted.double.json meta.embedded.shellscript.json meta.statement.shell meta.statement.command.shell meta.argument.shell
292+
# ^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. meta.structure.dictionary.value.json string.quoted.double.json meta.embedded.shellscript.json meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell punctuation.definition.string.begin.shell
293+
# ^^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. meta.structure.dictionary.value.json string.quoted.double.json meta.embedded.shellscript.json meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell punctuation.definition.string.begin.shell constant.character.escape.json
294+
# ^^^^^^^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. meta.structure.dictionary.value.json string.quoted.double.json meta.embedded.shellscript.json meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell
295+
# ^^^^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. meta.structure.dictionary.value.json string.quoted.double.json meta.embedded.shellscript.json meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell constant.character.escape.shell
296+
# ^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. meta.structure.dictionary.value.json string.quoted.double.json meta.embedded.shellscript.json meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell
297+
# ^^^^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. meta.structure.dictionary.value.json string.quoted.double.json meta.embedded.shellscript.json meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell constant.character.escape.shell
298+
# ^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. meta.structure.dictionary.value.json string.quoted.double.json meta.embedded.shellscript.json meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell
299+
# ^^^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. meta.structure.dictionary.value.json string.quoted.double.json meta.embedded.shellscript.json meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell constant.character.escape.shell
300+
# ^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. meta.structure.dictionary.value.json string.quoted.double.json meta.embedded.shellscript.json meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell
301+
# ^^^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. meta.structure.dictionary.value.json string.quoted.double.json meta.embedded.shellscript.json meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell constant.character.escape.shell
302+
# ^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. meta.structure.dictionary.value.json string.quoted.double.json meta.embedded.shellscript.json meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell
303+
# ^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. meta.structure.dictionary.value.json string.quoted.double.json meta.embedded.shellscript.json meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell punctuation.definition.variable.shell variable.parameter.positional.all.shell
304+
# ^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. meta.structure.dictionary.value.json string.quoted.double.json meta.embedded.shellscript.json meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell variable.parameter.positional.all.shell
305+
# ^^^^^^^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. meta.structure.dictionary.value.json string.quoted.double.json meta.embedded.shellscript.json meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell
306+
# ^^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. meta.structure.dictionary.value.json string.quoted.double.json meta.embedded.shellscript.json meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell punctuation.definition.string.end.shell constant.character.escape.json
307+
# ^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. meta.structure.dictionary.value.json string.quoted.double.json punctuation.definition.string.end.json
308+
# ^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.package. meta.structure.dictionary.value.json punctuation.separator.dictionary.pair.json
293309
> "watch": "tsc -watch -p ./",
294310
#^^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json
295311
# ^ source.json.embedded meta.structure.dictionary.json .meta.scripts. meta.structure.dictionary.value.json meta.structure.dictionary.json .meta.watch. string.json support.type.property-name.json punctuation.support.type.property-name.begin.json

syntaxes/tests/JSONC/negatives.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@
6868
]
6969
}
7070
},
71+
{
72+
"tasks": [
73+
{
74+
"command": "not-shell"
75+
}
76+
]
77+
},
7178
{
7279
"problemMatcher": {
7380
"pattern": {

0 commit comments

Comments
 (0)