From dfb8342ea003026e34e8aaefdb01a145a99db36a Mon Sep 17 00:00:00 2001 From: Keith Hill Date: Fri, 11 May 2018 18:28:48 -0600 Subject: [PATCH] Change SpecifyScriptArgs command to only return string - not string[] 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. --- src/features/DebugSession.ts | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/src/features/DebugSession.ts b/src/features/DebugSession.ts index 5b5cd1e1eb..b4919f8c0e 100644 --- a/src/features/DebugSession.ts +++ b/src/features/DebugSession.ts @@ -178,21 +178,10 @@ export class SpecifyScriptArgsFeature implements IFeature { private command: vscode.Disposable; private languageClient: LanguageClient; private context: vscode.ExtensionContext; - private emptyInputBoxBugFixed: boolean; constructor(context: vscode.ExtensionContext) { this.context = context; - const vscodeVersionArray = vscode.version.split("."); - const editorVersion = { - major: Number(vscodeVersionArray[0]), - minor: Number(vscodeVersionArray[1]), - }; - - this.emptyInputBoxBugFixed = - ((editorVersion.major > 1) || - ((editorVersion.major === 1) && (editorVersion.minor > 12))); - this.command = vscode.commands.registerCommand("PowerShell.SpecifyScriptArgs", () => { return this.specifyScriptArguments(); @@ -207,7 +196,7 @@ export class SpecifyScriptArgsFeature implements IFeature { this.command.dispose(); } - private specifyScriptArguments(): Thenable { + private specifyScriptArguments(): Thenable { const powerShellDbgScriptArgsKey = "powerShellDebugScriptArgs"; const options: vscode.InputBoxOptions = { @@ -215,21 +204,16 @@ export class SpecifyScriptArgsFeature implements IFeature { placeHolder: "Enter script arguments or leave empty to pass no args", }; - if (this.emptyInputBoxBugFixed) { - const prevArgs = this.context.workspaceState.get(powerShellDbgScriptArgsKey, ""); - if (prevArgs.length > 0) { - options.value = prevArgs; - } + const prevArgs = this.context.workspaceState.get(powerShellDbgScriptArgsKey, ""); + if (prevArgs.length > 0) { + options.value = prevArgs; } return vscode.window.showInputBox(options).then((text) => { // When user cancel's the input box (by pressing Esc), the text value is undefined. + // Let's not blow away the previous settting. if (text !== undefined) { - if (this.emptyInputBoxBugFixed) { - this.context.workspaceState.update(powerShellDbgScriptArgsKey, text); - } - - return new Array(text); + this.context.workspaceState.update(powerShellDbgScriptArgsKey, text); } return text;