Skip to content

Commit d65ccf8

Browse files
TylerLeonhardtrjmholt
authored andcommitted
Introduce new setting that controls UseLegacyReadLine (#2262)
1 parent c7a2adb commit d65ccf8

File tree

5 files changed

+16
-19
lines changed

5 files changed

+16
-19
lines changed

package.json

+5
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,11 @@
683683
"default": true,
684684
"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."
685685
},
686+
"powershell.integratedConsole.useLegacyReadLine": {
687+
"type": "boolean",
688+
"default": false,
689+
"description": "Falls back to the legacy (lightweight) ReadLine experience. This will disable the use of PSReadLine in the PowerShell Integrated Console."
690+
},
686691
"powershell.debugging.createTemporaryIntegratedConsole": {
687692
"type": "boolean",
688693
"default": false,

src/process.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ export class PowerShellProcess {
5757
this.startArgs +=
5858
`-LogPath '${PowerShellProcess.escapeSingleQuotes(editorServicesLogPath)}' ` +
5959
`-SessionDetailsPath '${PowerShellProcess.escapeSingleQuotes(this.sessionFilePath)}' ` +
60-
`-FeatureFlags @(${featureFlags})`;
60+
`-FeatureFlags @(${featureFlags}) `;
61+
62+
if (this.sessionSettings.integratedConsole.useLegacyReadLine) {
63+
this.startArgs += "-UseLegacyReadLine";
64+
}
6165

6266
const powerShellArgs = [
6367
"-NoProfile",

src/session.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,9 @@ export class SessionManager implements Middleware {
406406
settings.developer.editorServicesLogLevel.toLowerCase() !==
407407
this.sessionSettings.developer.editorServicesLogLevel.toLowerCase() ||
408408
settings.developer.bundledModulesPath.toLowerCase() !==
409-
this.sessionSettings.developer.bundledModulesPath.toLowerCase())) {
409+
this.sessionSettings.developer.bundledModulesPath.toLowerCase() ||
410+
settings.integratedConsole.useLegacyReadLine !==
411+
this.sessionSettings.integratedConsole.useLegacyReadLine)) {
410412

411413
vscode.window.showInformationMessage(
412414
"The PowerShell runtime configuration has changed, would you like to start a new session?",

src/settings.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export interface ISettings {
9898
export interface IIntegratedConsoleSettings {
9999
showOnStartup?: boolean;
100100
focusConsoleOnExecute?: boolean;
101+
useLegacyReadLine?: boolean;
101102
}
102103

103104
export function load(): ISettings {
@@ -118,14 +119,8 @@ export function load(): ISettings {
118119
createTemporaryIntegratedConsole: false,
119120
};
120121

121-
// TODO: Remove when PSReadLine is out of preview
122-
const featureFlags = [];
123-
if (utils.isWindowsOS()) {
124-
featureFlags.push("PSReadLine");
125-
}
126-
127122
const defaultDeveloperSettings: IDeveloperSettings = {
128-
featureFlags,
123+
featureFlags: [],
129124
powerShellExePath: undefined,
130125
bundledModulesPath: "../../../PowerShellEditorServices/module",
131126
editorServicesLogLevel: "Normal",
@@ -159,6 +154,7 @@ export function load(): ISettings {
159154
const defaultIntegratedConsoleSettings: IIntegratedConsoleSettings = {
160155
showOnStartup: true,
161156
focusConsoleOnExecute: true,
157+
useLegacyReadLine: false,
162158
};
163159

164160
return {

test/settings.test.ts

-10
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,6 @@ suite("Settings module", () => {
1010
assert.doesNotThrow(Settings.load);
1111
});
1212

13-
// TODO: Remove this test when PSReadLine is in stable
14-
test("PSReadLine featureFlag set correctly", () => {
15-
const settings: Settings.ISettings = Settings.load();
16-
if (process.platform === "win32") {
17-
assert.deepEqual(settings.developer.featureFlags, ["PSReadLine"]);
18-
} else {
19-
assert.deepEqual(settings.developer.featureFlags, []);
20-
}
21-
});
22-
2313
test("Settings update correctly", async () => {
2414
// then syntax
2515
Settings.change("helpCompletion", "BlockComment", false).then(() =>

0 commit comments

Comments
 (0)