Skip to content

Commit b0c7b38

Browse files
committed
fix: Error message for invalid args configuration.
1 parent 2c22844 commit b0c7b38

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/extension.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ class BashConfigurationProvider implements vscode.DebugConfigurationProvider {
5353
if (!config.type || !config.name) {
5454
let msg = "BUG in Bash Debug: reached to unreachable code.";
5555
msg += "\nIf it is reproducible, please report this bug on: https://github.com/rogalmic/vscode-bash-debug/issues";
56-
msg += "\nYou can avoid this bug by setting \"type\" and \"name\" attributes in launch.json.";
56+
msg += "\nYou can avoid this bug by setting `type` and `name` attributes in launch.json.";
5757
return vscode.window.showErrorMessage(msg).then(_ => { return undefined; });
5858
}
5959
if (!config.request) {
60-
let msg = "Please set \"request\" attribute to \"launch\".";
60+
let msg = "Please set `request` attribute to `launch`.";
6161
return vscode.window.showErrorMessage(msg).then(_ => { return undefined; });
6262
}
6363

@@ -77,11 +77,17 @@ class BashConfigurationProvider implements vscode.DebugConfigurationProvider {
7777

7878
// Check "required" attributes (defined in package.json) are included
7979
if (!config.program) {
80-
return vscode.window.showErrorMessage("Please specify \"program\" in launch.json.").then(_ => { return undefined; });
80+
return vscode.window.showErrorMessage("Please specify `program` in launch.json.").then(_ => { return undefined; });
8181
}
8282

8383
// Fill non-"required" attributes with default values to prevent bashdb (or other programs) from panic
84-
if (!config.args) { config.args = []; }
84+
if (!config.args) {
85+
config.args = [];
86+
}
87+
else if (!Array.isArray(config.args)) {
88+
return vscode.window.showErrorMessage("Please specify `args` as array of strings in launch.json.").then(_ => { return undefined; });
89+
}
90+
8591
if (!config.env) { config.env = {}; }
8692
if (!config.cwd) {
8793
if (!folder) {

0 commit comments

Comments
 (0)