Skip to content

When migrating old whitespaceAroundPipe setting to AddWhitespaceAroundPipe, remove old setting now #2830

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 1 commit into from
Jul 23, 2020
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 @@ -801,6 +801,11 @@
"default": false,
"description": "Removes redundant whitespace between parameters."
},
"powershell.codeFormatting.whitespaceAroundPipe": {
"type": "boolean",
"default": true,
"description": "REMOVED. Please use the \"powershell.codeFormatting.addWhitespaceAroundPipe\" setting instead. If you've used this setting before, we have moved it for you automatically."
},
"powershell.codeFormatting.addWhitespaceAroundPipe": {
"type": "boolean",
"default": true,
Expand Down
4 changes: 2 additions & 2 deletions src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,7 @@ export class SessionManager implements Middleware {
return resolvedCodeLens;
}

// During preview, populate a new setting value but not remove the old value.
// TODO: When the next stable extension releases, then the old value can be safely removed. Tracked in this issue: https://github.com/PowerShell/vscode-powershell/issues/2693
// Move old setting codeFormatting.whitespaceAroundPipe to new setting codeFormatting.addWhitespaceAroundPipe
private async migrateWhitespaceAroundPipeSetting() {
const configuration = vscode.workspace.getConfiguration(utils.PowerShellLanguageId);
const deprecatedSetting = 'codeFormatting.whitespaceAroundPipe'
Expand All @@ -337,6 +336,7 @@ export class SessionManager implements Middleware {
const configurationTarget = await Settings.getEffectiveConfigurationTarget(deprecatedSetting);
const value = configuration.get(deprecatedSetting, configurationTarget)
await Settings.change(newSetting, value, configurationTarget);
await Settings.change(deprecatedSetting, undefined, configurationTarget);
}
}

Expand Down