Skip to content

Introduce new setting that controls UseLegacyReadLine #2262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 5 additions & 1 deletion src/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 3 additions & 1 deletion src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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?",
Expand Down
10 changes: 3 additions & 7 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export interface ISettings {
export interface IIntegratedConsoleSettings {
showOnStartup?: boolean;
focusConsoleOnExecute?: boolean;
useLegacyReadLine?: boolean;
}

export function load(): ISettings {
Expand All @@ -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",
Expand Down Expand Up @@ -159,6 +154,7 @@ export function load(): ISettings {
const defaultIntegratedConsoleSettings: IIntegratedConsoleSettings = {
showOnStartup: true,
focusConsoleOnExecute: true,
useLegacyReadLine: false,
};

return {
Expand Down
10 changes: 0 additions & 10 deletions test/settings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() =>
Expand Down