Skip to content

Commit 8ce4be4

Browse files
authored
Change SpecifyScriptArgs command to only return string - not string[] (#1317)
Fix #1315 but folks won't see this fix until they are on VSCode 1.24 or insiders build >= 5/11. This is because a corresponding fix is required in VSCode.
1 parent 703763e commit 8ce4be4

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed

src/features/DebugSession.ts

+6-22
Original file line numberDiff line numberDiff line change
@@ -178,21 +178,10 @@ export class SpecifyScriptArgsFeature implements IFeature {
178178
private command: vscode.Disposable;
179179
private languageClient: LanguageClient;
180180
private context: vscode.ExtensionContext;
181-
private emptyInputBoxBugFixed: boolean;
182181

183182
constructor(context: vscode.ExtensionContext) {
184183
this.context = context;
185184

186-
const vscodeVersionArray = vscode.version.split(".");
187-
const editorVersion = {
188-
major: Number(vscodeVersionArray[0]),
189-
minor: Number(vscodeVersionArray[1]),
190-
};
191-
192-
this.emptyInputBoxBugFixed =
193-
((editorVersion.major > 1) ||
194-
((editorVersion.major === 1) && (editorVersion.minor > 12)));
195-
196185
this.command =
197186
vscode.commands.registerCommand("PowerShell.SpecifyScriptArgs", () => {
198187
return this.specifyScriptArguments();
@@ -207,29 +196,24 @@ export class SpecifyScriptArgsFeature implements IFeature {
207196
this.command.dispose();
208197
}
209198

210-
private specifyScriptArguments(): Thenable<string[] | string> {
199+
private specifyScriptArguments(): Thenable<string> {
211200
const powerShellDbgScriptArgsKey = "powerShellDebugScriptArgs";
212201

213202
const options: vscode.InputBoxOptions = {
214203
ignoreFocusOut: true,
215204
placeHolder: "Enter script arguments or leave empty to pass no args",
216205
};
217206

218-
if (this.emptyInputBoxBugFixed) {
219-
const prevArgs = this.context.workspaceState.get(powerShellDbgScriptArgsKey, "");
220-
if (prevArgs.length > 0) {
221-
options.value = prevArgs;
222-
}
207+
const prevArgs = this.context.workspaceState.get(powerShellDbgScriptArgsKey, "");
208+
if (prevArgs.length > 0) {
209+
options.value = prevArgs;
223210
}
224211

225212
return vscode.window.showInputBox(options).then((text) => {
226213
// When user cancel's the input box (by pressing Esc), the text value is undefined.
214+
// Let's not blow away the previous settting.
227215
if (text !== undefined) {
228-
if (this.emptyInputBoxBugFixed) {
229-
this.context.workspaceState.update(powerShellDbgScriptArgsKey, text);
230-
}
231-
232-
return new Array(text);
216+
this.context.workspaceState.update(powerShellDbgScriptArgsKey, text);
233217
}
234218

235219
return text;

0 commit comments

Comments
 (0)