From 46feae5df20d32b4a8a41e290c999ab4cb895860 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Wed, 30 Oct 2019 10:52:54 -0700 Subject: [PATCH 1/3] introduce new setting that controls UseLegacyReadLine --- package.json | 5 +++++ src/process.ts | 6 +++++- src/settings.ts | 10 +++------- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index c142503f58..8c57054b46 100644 --- a/package.json +++ b/package.json @@ -683,6 +683,11 @@ "default": true, "description": "Switches focus to the console when a script selection is run or a script file is debugged. This is an accessibility feature. To disable it, set to false." }, + "powershell.integratedConsole.useLegacyReadLine": { + "type": "boolean", + "default": false, + "description": "Falls back to the legacy (lightweight) ReadLine experience. This will disable the use of PSReadLine in the PowerShell Integrated Console." + }, "powershell.debugging.createTemporaryIntegratedConsole": { "type": "boolean", "default": false, diff --git a/src/process.ts b/src/process.ts index ec1b73b1b0..051da88488 100644 --- a/src/process.ts +++ b/src/process.ts @@ -57,7 +57,11 @@ export class PowerShellProcess { this.startArgs += `-LogPath '${PowerShellProcess.escapeSingleQuotes(editorServicesLogPath)}' ` + `-SessionDetailsPath '${PowerShellProcess.escapeSingleQuotes(this.sessionFilePath)}' ` + - `-FeatureFlags @(${featureFlags})`; + `-FeatureFlags @(${featureFlags}) `; + + if (this.sessionSettings.integratedConsole.useLegacyReadLine) { + this.startArgs += "-UseLegacyReadLine"; + } const powerShellArgs = [ "-NoProfile", diff --git a/src/settings.ts b/src/settings.ts index 8a4e3ac9b7..e7c9eea499 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -98,6 +98,7 @@ export interface ISettings { export interface IIntegratedConsoleSettings { showOnStartup?: boolean; focusConsoleOnExecute?: boolean; + useLegacyReadLine?: boolean; } export function load(): ISettings { @@ -118,14 +119,8 @@ export function load(): ISettings { createTemporaryIntegratedConsole: false, }; - // TODO: Remove when PSReadLine is out of preview - const featureFlags = []; - if (utils.isWindowsOS()) { - featureFlags.push("PSReadLine"); - } - const defaultDeveloperSettings: IDeveloperSettings = { - featureFlags, + featureFlags: [], powerShellExePath: undefined, bundledModulesPath: "../../../PowerShellEditorServices/module", editorServicesLogLevel: "Normal", @@ -159,6 +154,7 @@ export function load(): ISettings { const defaultIntegratedConsoleSettings: IIntegratedConsoleSettings = { showOnStartup: true, focusConsoleOnExecute: true, + useLegacyReadLine: false, }; return { From 666ec72f6fbe8465b88ace4fa5df95d7d03c6f76 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Wed, 30 Oct 2019 11:30:35 -0700 Subject: [PATCH 2/3] show restart menu when setting changes --- src/session.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/session.ts b/src/session.ts index 4fb4186f92..9d552b9ca3 100644 --- a/src/session.ts +++ b/src/session.ts @@ -406,7 +406,9 @@ export class SessionManager implements Middleware { settings.developer.editorServicesLogLevel.toLowerCase() !== this.sessionSettings.developer.editorServicesLogLevel.toLowerCase() || settings.developer.bundledModulesPath.toLowerCase() !== - this.sessionSettings.developer.bundledModulesPath.toLowerCase())) { + this.sessionSettings.developer.bundledModulesPath.toLowerCase() || + settings.integratedConsole.useLegacyReadLine !== + this.sessionSettings.integratedConsole.useLegacyReadLine)) { vscode.window.showInformationMessage( "The PowerShell runtime configuration has changed, would you like to start a new session?", From 88e535f6afd7ebec9f24a690a1b6d5e1f7bc4301 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Wed, 30 Oct 2019 11:44:42 -0700 Subject: [PATCH 3/3] remove psrl test --- test/settings.test.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/test/settings.test.ts b/test/settings.test.ts index ecbaedfb48..6117d170f2 100644 --- a/test/settings.test.ts +++ b/test/settings.test.ts @@ -10,16 +10,6 @@ suite("Settings module", () => { assert.doesNotThrow(Settings.load); }); - // TODO: Remove this test when PSReadLine is in stable - test("PSReadLine featureFlag set correctly", () => { - const settings: Settings.ISettings = Settings.load(); - if (process.platform === "win32") { - assert.deepEqual(settings.developer.featureFlags, ["PSReadLine"]); - } else { - assert.deepEqual(settings.developer.featureFlags, []); - } - }); - test("Settings update correctly", async () => { // then syntax Settings.change("helpCompletion", "BlockComment", false).then(() =>