From c7f97c5ffa0a280a718699824c1c125c1fe63cd2 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Wed, 13 Nov 2019 15:34:15 -0800 Subject: [PATCH 1/6] Use powerShellDefaultVersion everywhere and stop using powerShellExePath --- package.json | 8 +- src/features/GenerateBugReport.ts | 2 +- src/session.ts | 199 +++++++----------------------- src/settings.ts | 2 + test/settings.test.ts | 12 +- 5 files changed, 55 insertions(+), 168 deletions(-) diff --git a/package.json b/package.json index f28fac36ec..29509aef9a 100644 --- a/package.json +++ b/package.json @@ -499,12 +499,6 @@ "default": [], "description": "Specify array of Modules to exclude from Command Explorer listing." }, - "powershell.powerShellExePath": { - "type": "string", - "default": "", - "scope": "machine", - "description": "Specifies the full path to a PowerShell executable. Changes the installation of PowerShell used for language and debugging services." - }, "powershell.powerShellAdditionalExePaths": { "type": "array", "description": "Specifies an array of versionName / exePath pairs where exePath points to a non-standard install location for PowerShell and versionName can be used to reference this path with the powershell.powerShellDefaultVersion setting.", @@ -530,7 +524,7 @@ }, "powershell.powerShellDefaultVersion": { "type": "string", - "description": "Specifies the PowerShell version name, as displayed by the 'PowerShell: Show Session Menu' command, used when the extension loads e.g \"Windows PowerShell (x86)\" or \"PowerShell Core 6 (x64)\"." + "description": "Specifies the PowerShell version name, as displayed by the 'PowerShell: Show Session Menu' command, used when the extension loads e.g \"Windows PowerShell (x86)\" or \"PowerShell Core 6 (x64)\". You can specify additional PowerShell executables by using the \"powershell.powerShellAdditionalExePaths\" setting." }, "powershell.promptToUpdatePowerShell": { "type": "boolean", diff --git a/src/features/GenerateBugReport.ts b/src/features/GenerateBugReport.ts index d66487bc35..111fa85fcc 100644 --- a/src/features/GenerateBugReport.ts +++ b/src/features/GenerateBugReport.ts @@ -113,7 +113,7 @@ ${tableHeader}\n${table}; private getRuntimeInfo() { - const powerShellExePath = this.sessionManager.getPowerShellExePath(); + const powerShellExePath = this.sessionManager.PowerShellExeDetails.exePath; const powerShellArgs = [ "-NoProfile", "-Command", diff --git a/src/session.ts b/src/session.ts index 9d552b9ca3..d711b1ee69 100644 --- a/src/session.ts +++ b/src/session.ts @@ -2,7 +2,6 @@ * Copyright (C) Microsoft Corporation. All rights reserved. *--------------------------------------------------------*/ -import cp = require("child_process"); import fs = require("fs"); import net = require("net"); import path = require("path"); @@ -17,13 +16,13 @@ import Settings = require("./settings"); import utils = require("./utils"); import { - CloseAction, DocumentSelector, ErrorAction, Executable, LanguageClient, LanguageClientOptions, - Middleware, NotificationType, RequestType, RequestType0, + CloseAction, DocumentSelector, ErrorAction, LanguageClient, LanguageClientOptions, + Middleware, NotificationType, RequestType0, ResolveCodeLensSignature, RevealOutputChannelOn, StreamInfo } from "vscode-languageclient"; import { GitHubReleaseInformation, InvokePowerShellUpdateCheck } from "./features/UpdatePowerShell"; import { - getPlatformDetails, IPlatformDetails, + getPlatformDetails, IPlatformDetails, IPowerShellExeDetails, OperatingSystem, PowerShellExeFinder } from "./platform"; export enum SessionStatus { @@ -37,9 +36,9 @@ export enum SessionStatus { export class SessionManager implements Middleware { public HostVersion: string; + public PowerShellExeDetails: IPowerShellExeDetails; private ShowSessionMenuCommandName = "PowerShell.ShowSessionMenu"; private editorServicesArgs: string; - private powerShellExePath: string = ""; private sessionStatus: SessionStatus = SessionStatus.NeverStarted; private suppressRestartPrompt: boolean; private focusConsoleOnExecute: boolean; @@ -119,15 +118,17 @@ export class SessionManager implements Middleware { this.createStatusBarItem(); + this.promptPowerShellExeSettingsCleanup(); + try { - this.powerShellExePath = this.getPowerShellExePath(); + this.PowerShellExeDetails = this.powershellExeFinder.getFirstAvailablePowerShellInstallation(); } catch (e) { this.log.writeError(`Error occurred while searching for a PowerShell executable:\n${e}`); } this.suppressRestartPrompt = false; - if (!this.powerShellExePath) { + if (!this.PowerShellExeDetails) { const message = "Unable to find PowerShell." + " Do you have PowerShell installed?" + " You can also configure custom PowerShell installations" @@ -230,7 +231,7 @@ export class SessionManager implements Middleware { this.debugSessionProcess = new PowerShellProcess( - this.powerShellExePath, + this.PowerShellExeDetails.exePath, this.bundledModulesPath, "[TEMP] PowerShell Integrated Console", this.log, @@ -241,51 +242,6 @@ export class SessionManager implements Middleware { return this.debugSessionProcess; } - public getPowerShellExePath(): string { - if (!this.sessionSettings.powerShellExePath && - this.sessionSettings.developer.powerShellExePath) { - // Show deprecation message with fix action. - // We don't need to wait on this to complete - // because we can finish gathering the configured - // PowerShell path without the fix - this.showExePathSettingDeprecationWarning(); - } - - let powerShellExePath: string = this.getConfiguredPowerShellExePath().trim(); - - // New versions of PS Core uninstall the previous version - // so make sure the path stored in the settings exists. - if (!fs.existsSync(powerShellExePath)) { - this.log.write( - `Path specified by 'powerShellExePath' setting - '${powerShellExePath}' - not found, ` + - "reverting to default PowerShell path."); - powerShellExePath = ""; - } - - if (powerShellExePath) { - if (this.platformDetails.operatingSystem === OperatingSystem.Windows) { - // Check the path bitness - const fixedPath = this.powershellExeFinder.fixWindowsPowerShellPath( - powerShellExePath); - - if (fixedPath !== powerShellExePath) { - // Show deprecation message with fix action. - // We don't need to wait on this to complete - // because we can finish gathering the configured - // PowerShell path without the fix - this.showBitnessPathFixWarning(fixedPath); - powerShellExePath = fixedPath; - } - } - - return this.resolvePowerShellPath(powerShellExePath); - } - - // No need to resolve this path, since the finder guarantees its existence - const firstPowerShell = this.powershellExeFinder.getFirstAvailablePowerShellInstallation(); - return firstPowerShell && firstPowerShell.exePath || null; - } - // ----- LanguageClient middleware methods ----- public resolveCodeLens( @@ -331,64 +287,37 @@ export class SessionManager implements Middleware { return resolvedCodeLens; } - private async showExePathSettingDeprecationWarning(): Promise { - const choice: string = await vscode.window.showWarningMessage( - "The 'powershell.developer.powerShellExePath' setting is deprecated, use " + - "'powershell.powerShellExePath' instead.", - "Fix Automatically"); - - if (!choice) { - return; - } - - this.suppressRestartPrompt = true; - await Settings.change("powerShellExePath", this.sessionSettings.developer.powerShellExePath, true); - await Settings.change("developer.powerShellExePath", undefined, true); - this.suppressRestartPrompt = false; - } - - private async showBitnessPathFixWarning(fixedPath: string): Promise { - const bitness = this.platformDetails.isOS64Bit ? "64" : "32"; + private async promptPowerShellExeSettingsCleanup() { + if (this.sessionSettings.powerShellExePath) { + let warningMessage = "The 'powerShell.powerShellExePath' setting is no longer used. "; + warningMessage += this.sessionSettings.powerShellDefaultVersion + ? "We can automatically remove it for you." + : "We can remove it from your settings and prompt you for which PowerShell you want to use."; - const choice = await vscode.window.showWarningMessage( - `The specified PowerShell path is incorrect for ${bitness}-bit VS Code, using '${fixedPath}' instead.`, - "Fix Setting Automatically"); + const choice = await vscode.window.showWarningMessage(warningMessage, "Let's do it!"); - if (!choice) { - return; - } + if (choice === "") { + // They hit the 'x' to close the dialog. + return; + } - this.suppressRestartPrompt = true; - await Settings.change("powerShellExePath", this.sessionSettings.developer.powerShellExePath, true); - await Settings.change("developer.powerShellExePath", undefined, true); - this.suppressRestartPrompt = false; - } + this.suppressRestartPrompt = true; + try { + await Settings.change("powerShellExePath", undefined, true); - private getConfiguredPowerShellExePath(): string { - // If powershell.powerShellDefaultVersion specified, attempt to find the PowerShell exe path - // of the version specified by the setting. - if (this.sessionSettings.powerShellDefaultVersion && this.sessionStatus === SessionStatus.NeverStarted) { - for (const pwshExe of this.powershellExeFinder.enumeratePowerShellInstallations()) { - if (pwshExe.displayName === this.sessionSettings.powerShellDefaultVersion) { - return pwshExe.exePath; + // This has been deprecated for a while so siliently remove it if it's there. + if (this.sessionSettings.developer.powerShellExePath) { + await Settings.change("developer.powerShellExePath", undefined, true); } + } finally { + this.suppressRestartPrompt = false; } - // Default PowerShell version was configured but we didn't find it - this.log.writeWarning( - `Could not find powerShellDefaultVersion: '${this.sessionSettings.powerShellDefaultVersion}'`); - } - - if (this.sessionSettings.powerShellExePath) { - return this.sessionSettings.powerShellExePath; - } - - if (this.sessionSettings.developer.powerShellExePath) { - this.showExePathSettingDeprecationWarning(); - return this.sessionSettings.developer.powerShellExePath; + // Show the session menu at the end if they don't have a PowerShellDefaultVersion. + if (!this.sessionSettings.powerShellDefaultVersion) { + await vscode.commands.executeCommand(this.ShowSessionMenuCommandName); + } } - - return ""; } private onConfigurationUpdated() { @@ -398,11 +327,10 @@ export class SessionManager implements Middleware { // Detect any setting changes that would affect the session if (!this.suppressRestartPrompt && - (settings.useX86Host !== this.sessionSettings.useX86Host || - settings.powerShellExePath.toLowerCase() !== this.sessionSettings.powerShellExePath.toLowerCase() || - (settings.developer.powerShellExePath ? settings.developer.powerShellExePath.toLowerCase() : null) !== - (this.sessionSettings.developer.powerShellExePath - ? this.sessionSettings.developer.powerShellExePath.toLowerCase() : null) || + (settings.useX86Host !== + this.sessionSettings.useX86Host || + settings.powerShellDefaultVersion.toLowerCase() !== + this.sessionSettings.powerShellDefaultVersion.toLowerCase() || settings.developer.editorServicesLogLevel.toLowerCase() !== this.sessionSettings.developer.editorServicesLogLevel.toLowerCase() || settings.developer.bundledModulesPath.toLowerCase() !== @@ -461,7 +389,7 @@ export class SessionManager implements Middleware { this.languageServerProcess = new PowerShellProcess( - this.powerShellExePath, + this.PowerShellExeDetails.exePath, this.bundledModulesPath, "PowerShell Integrated Console", this.log, @@ -691,55 +619,13 @@ export class SessionManager implements Middleware { SessionStatus.Failed); } - private changePowerShellExePath(exePath: string) { + private changePowerShellDefaultVersion(exePath: IPowerShellExeDetails) { this.suppressRestartPrompt = true; Settings - .change("powerShellExePath", exePath, true) + .change("powerShellDefaultVersion", exePath.displayName, true) .then(() => this.restartSession()); } - private resolvePowerShellPath(powerShellExePath: string): string { - const resolvedPath = path.resolve(__dirname, powerShellExePath); - - // If the path does not exist, show an error - if (!utils.checkIfFileExists(resolvedPath)) { - const pwshPath = resolvedPath || powerShellExePath; - const pwshExeName = path.basename(pwshPath) || "PowerShell executable"; - - this.setSessionFailure(`${pwshExeName} cannot be found or is not accessible at path '${pwshPath}'`); - - return null; - } - - return resolvedPath; - } - - private getPowerShellVersionLabel(): string { - if (this.powerShellExePath) { - const powerShellCommandLine = [ - this.powerShellExePath, - "-NoProfile", - "-NonInteractive", - ]; - - // Only add ExecutionPolicy param on Windows - if (utils.isWindowsOS()) { - powerShellCommandLine.push("-ExecutionPolicy", "Bypass"); - } - - powerShellCommandLine.push( - "-Command", - "'$PSVersionTable | ConvertTo-Json'"); - - const powerShellOutput = cp.execSync(powerShellCommandLine.join(" ")); - const versionDetails = JSON.parse(powerShellOutput.toString()); - return versionDetails.PSVersion.Label; - } else { - // TODO: throw instead? - return null; - } - } - private showSessionConsole(isExecute?: boolean) { if (this.languageServerProcess) { this.languageServerProcess.showConsole(isExecute && !this.focusConsoleOnExecute); @@ -747,7 +633,6 @@ export class SessionManager implements Middleware { } private showSessionMenu() { - const currentExePath = (this.powerShellExePath || "").toLowerCase(); const availablePowerShellExes = this.powershellExeFinder.getAllAvailablePowerShellInstallations(); let sessionText: string; @@ -760,7 +645,7 @@ export class SessionManager implements Middleware { case SessionStatus.Stopping: const currentPowerShellExe = availablePowerShellExes - .find((item) => item.exePath.toLowerCase() === currentExePath); + .find((item) => item.displayName.toLowerCase() === this.PowerShellExeDetails.displayName); const powerShellSessionName = currentPowerShellExe ? @@ -782,11 +667,11 @@ export class SessionManager implements Middleware { const powerShellItems = availablePowerShellExes - .filter((item) => item.exePath.toLowerCase() !== currentExePath) + .filter((item) => item.displayName.toLowerCase() !== this.PowerShellExeDetails.displayName) .map((item) => { return new SessionMenuItem( `Switch to: ${item.displayName}`, - () => { this.changePowerShellExePath(item.exePath); }); + () => { this.changePowerShellDefaultVersion(item); }); }); const menuItems: SessionMenuItem[] = [ diff --git a/src/settings.ts b/src/settings.ts index e7c9eea499..188217ca1f 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -69,6 +69,7 @@ export interface IDebuggingSettings { export interface IDeveloperSettings { featureFlags?: string[]; + // This setting is no longer used but is here to assist in cleaning up the users settings. powerShellExePath?: string; bundledModulesPath?: string; editorServicesLogLevel?: string; @@ -79,6 +80,7 @@ export interface IDeveloperSettings { export interface ISettings { powerShellAdditionalExePaths?: IPowerShellAdditionalExePathSettings[]; powerShellDefaultVersion?: string; + // This setting is no longer used but is here to assist in cleaning up the users settings. powerShellExePath?: string; promptToUpdatePowerShell?: boolean; bundledModulesPath?: string; diff --git a/test/settings.test.ts b/test/settings.test.ts index 6117d170f2..d6e42122b6 100644 --- a/test/settings.test.ts +++ b/test/settings.test.ts @@ -3,6 +3,7 @@ *--------------------------------------------------------*/ import * as assert from "assert"; +import { IPowerShellExeDetails } from "../src/platform"; import Settings = require("../src/settings"); suite("Settings module", () => { @@ -22,10 +23,15 @@ suite("Settings module", () => { test("Settings that can only be user settings update correctly", async () => { // set to false means it's set as a workspace-level setting so this should throw. - assert.rejects(async () => await Settings.change("powerShellExePath", "dummyPath", false)); + const psExeDetails = [{ + versionName: "My PowerShell", + exePath: "dummyPath", + }]; + + assert.rejects(async () => await Settings.change("powerShellAdditionalExePaths", psExeDetails, false)); // set to true means it's a user-level setting so this should not throw. - await Settings.change("powerShellExePath", "dummyPath", true); - assert.strictEqual(Settings.load().powerShellExePath, "dummyPath"); + await Settings.change("powerShellAdditionalExePaths", psExeDetails, true); + assert.strictEqual(Settings.load().powerShellAdditionalExePaths[0].versionName, psExeDetails[0].versionName); }); }); From 600de8cebff4364268c56f99403b751b79d696b1 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Wed, 13 Nov 2019 16:03:42 -0800 Subject: [PATCH 2/6] add modify settings in session menu --- src/session.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/session.ts b/src/session.ts index d711b1ee69..ffb9db7206 100644 --- a/src/session.ts +++ b/src/session.ts @@ -667,7 +667,7 @@ export class SessionManager implements Middleware { const powerShellItems = availablePowerShellExes - .filter((item) => item.displayName.toLowerCase() !== this.PowerShellExeDetails.displayName) + .filter((item) => item.displayName !== this.PowerShellExeDetails.displayName) .map((item) => { return new SessionMenuItem( `Switch to: ${item.displayName}`, @@ -679,16 +679,20 @@ export class SessionManager implements Middleware { sessionText, () => { vscode.commands.executeCommand("PowerShell.ShowLogs"); }), + // Add all of the different PowerShell options + ...powerShellItems, + new SessionMenuItem( "Restart Current Session", () => { this.restartSession(); }), - // Add all of the different PowerShell options - ...powerShellItems, - new SessionMenuItem( "Open Session Logs Folder", () => { vscode.commands.executeCommand("PowerShell.OpenLogFolder"); }), + + new SessionMenuItem( + "Modify 'powerShell.powerShellAdditionalExePaths' in Settings", + () => { vscode.commands.executeCommand("workbench.action.openSettingsJson"); }), ]; vscode From 47ccbba1abc4efcc1fbe5bfe248551419c9cdb70 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Wed, 13 Nov 2019 16:51:48 -0800 Subject: [PATCH 3/6] re-add powerShellExePath to package.json so vscode api can update it and remove references to developer.powerShellExePath --- package.json | 6 ++++++ src/session.ts | 5 ----- src/settings.ts | 2 -- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 29509aef9a..14a9d89741 100644 --- a/package.json +++ b/package.json @@ -526,6 +526,12 @@ "type": "string", "description": "Specifies the PowerShell version name, as displayed by the 'PowerShell: Show Session Menu' command, used when the extension loads e.g \"Windows PowerShell (x86)\" or \"PowerShell Core 6 (x64)\". You can specify additional PowerShell executables by using the \"powershell.powerShellAdditionalExePaths\" setting." }, + "powershell.powerShellExePath": { + "type": "string", + "default": "", + "scope": "machine", + "description": "REMOVED. Please use the \"powershell.powerShellDefaultVersion\" setting instead." + }, "powershell.promptToUpdatePowerShell": { "type": "boolean", "description": "Specifies whether you should be prompted to update your version of PowerShell.", diff --git a/src/session.ts b/src/session.ts index ffb9db7206..17cd094ec2 100644 --- a/src/session.ts +++ b/src/session.ts @@ -304,11 +304,6 @@ export class SessionManager implements Middleware { this.suppressRestartPrompt = true; try { await Settings.change("powerShellExePath", undefined, true); - - // This has been deprecated for a while so siliently remove it if it's there. - if (this.sessionSettings.developer.powerShellExePath) { - await Settings.change("developer.powerShellExePath", undefined, true); - } } finally { this.suppressRestartPrompt = false; } diff --git a/src/settings.ts b/src/settings.ts index 188217ca1f..9264b4ccd7 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -70,7 +70,6 @@ export interface IDebuggingSettings { export interface IDeveloperSettings { featureFlags?: string[]; // This setting is no longer used but is here to assist in cleaning up the users settings. - powerShellExePath?: string; bundledModulesPath?: string; editorServicesLogLevel?: string; editorServicesWaitForDebugger?: boolean; @@ -123,7 +122,6 @@ export function load(): ISettings { const defaultDeveloperSettings: IDeveloperSettings = { featureFlags: [], - powerShellExePath: undefined, bundledModulesPath: "../../../PowerShellEditorServices/module", editorServicesLogLevel: "Normal", editorServicesWaitForDebugger: false, From 01c4a2bf5b3baea497e1e589291a2b451c051b52 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Wed, 13 Nov 2019 17:14:14 -0800 Subject: [PATCH 4/6] actually use setting... --- src/session.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/session.ts b/src/session.ts index 17cd094ec2..360077e5ea 100644 --- a/src/session.ts +++ b/src/session.ts @@ -121,7 +121,19 @@ export class SessionManager implements Middleware { this.promptPowerShellExeSettingsCleanup(); try { - this.PowerShellExeDetails = this.powershellExeFinder.getFirstAvailablePowerShellInstallation(); + let powerShellExeDetails; + if (this.sessionSettings.powerShellDefaultVersion) { + for (const details of this.powershellExeFinder.enumeratePowerShellInstallations()) { + if (details.displayName === this.sessionSettings.powerShellDefaultVersion) { + powerShellExeDetails = details; + break; + } + } + } + + this.PowerShellExeDetails = powerShellExeDetails || + this.powershellExeFinder.getFirstAvailablePowerShellInstallation(); + } catch (e) { this.log.writeError(`Error occurred while searching for a PowerShell executable:\n${e}`); } From 92a496b22fc556e585dd54925a96c28a922862a7 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Thu, 14 Nov 2019 15:26:05 -0800 Subject: [PATCH 5/6] still switch even if workspace setting is set --- src/session.ts | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/session.ts b/src/session.ts index 360077e5ea..f91b3524a7 100644 --- a/src/session.ts +++ b/src/session.ts @@ -104,8 +104,11 @@ export class SessionManager implements Middleware { this.extensionFeatures = extensionFeatures; } - public start() { + public start(exeNameOverride?: string) { this.sessionSettings = Settings.load(); + if (exeNameOverride) { + this.sessionSettings.powerShellDefaultVersion = exeNameOverride; + } this.log.startNewLog(this.sessionSettings.developer.editorServicesLogLevel); @@ -225,6 +228,11 @@ export class SessionManager implements Middleware { this.sessionStatus = SessionStatus.NotStarted; } + public restartSession(exeNameOverride?: string) { + this.stop(); + this.start(exeNameOverride); + } + public getSessionDetails(): utils.IEditorServicesSessionDetails { return this.sessionDetails; } @@ -572,11 +580,6 @@ export class SessionManager implements Middleware { }); } - private restartSession() { - this.stop(); - this.start(); - } - private createStatusBarItem() { if (this.statusBarItem === undefined) { // Create the status bar item and place it right next @@ -630,7 +633,11 @@ export class SessionManager implements Middleware { this.suppressRestartPrompt = true; Settings .change("powerShellDefaultVersion", exePath.displayName, true) - .then(() => this.restartSession()); + // We pass in the display name so that we force the extension to use that version + // rather than pull from the settings. The issue we prevent here is when a + // workspace setting is defined which gets priority over user settings which + // is what the change above sets. + .then(() => this.restartSession(exePath.displayName)); } private showSessionConsole(isExecute?: boolean) { @@ -691,7 +698,11 @@ export class SessionManager implements Middleware { new SessionMenuItem( "Restart Current Session", - () => { this.restartSession(); }), + () => { + // We pass in the display name so we guarentee that the session + // will be the same PowerShell. + this.restartSession(this.PowerShellExeDetails.displayName); + }), new SessionMenuItem( "Open Session Logs Folder", From b598f7c404e0b3b9018a9ca1d70ec3dc5c5bcb63 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Thu, 21 Nov 2019 11:24:18 -0800 Subject: [PATCH 6/6] rob's feedback --- src/session.ts | 16 ++++++++-------- src/settings.ts | 1 - 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/session.ts b/src/session.ts index f91b3524a7..7b4e5cb6b8 100644 --- a/src/session.ts +++ b/src/session.ts @@ -629,15 +629,15 @@ export class SessionManager implements Middleware { SessionStatus.Failed); } - private changePowerShellDefaultVersion(exePath: IPowerShellExeDetails) { + private async changePowerShellDefaultVersion(exePath: IPowerShellExeDetails) { this.suppressRestartPrompt = true; - Settings - .change("powerShellDefaultVersion", exePath.displayName, true) - // We pass in the display name so that we force the extension to use that version - // rather than pull from the settings. The issue we prevent here is when a - // workspace setting is defined which gets priority over user settings which - // is what the change above sets. - .then(() => this.restartSession(exePath.displayName)); + await Settings.change("powerShellDefaultVersion", exePath.displayName, true); + + // We pass in the display name so that we force the extension to use that version + // rather than pull from the settings. The issue we prevent here is when a + // workspace setting is defined which gets priority over user settings which + // is what the change above sets. + this.restartSession(exePath.displayName); } private showSessionConsole(isExecute?: boolean) { diff --git a/src/settings.ts b/src/settings.ts index 9264b4ccd7..d29e4ee33c 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -69,7 +69,6 @@ export interface IDebuggingSettings { export interface IDeveloperSettings { featureFlags?: string[]; - // This setting is no longer used but is here to assist in cleaning up the users settings. bundledModulesPath?: string; editorServicesLogLevel?: string; editorServicesWaitForDebugger?: boolean;