Skip to content

Commit 252a2c5

Browse files
bergmeisterChristoph Bergmeister
and
Christoph Bergmeister
authored
Tweak whitespaceAroundPipe settings migration logic to do it only once (#2703)
* Tweak whitespaceAroundPipe settings migration logic to do it only once * refactor Co-authored-by: Christoph Bergmeister <christoph.bergmeister@bjss.com>
1 parent 3256d4e commit 252a2c5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/session.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,10 +324,12 @@ export class SessionManager implements Middleware {
324324
private async migrateWhitespaceAroundPipeSetting() {
325325
const configuration = vscode.workspace.getConfiguration(utils.PowerShellLanguageId);
326326
const deprecatedSetting = 'codeFormatting.whitespaceAroundPipe'
327-
if (configuration.has(deprecatedSetting) && !configuration.has('codeFormatting.addWhitespaceAroundPipe')) {
327+
const newSetting = 'codeFormatting.addWhitespaceAroundPipe'
328+
const configurationTargetOfNewSetting = await Settings.getEffectiveConfigurationTarget(newSetting);
329+
if (configuration.has(deprecatedSetting) && configurationTargetOfNewSetting === null) {
328330
const configurationTarget = await Settings.getEffectiveConfigurationTarget(deprecatedSetting);
329331
const value = configuration.get(deprecatedSetting, configurationTarget)
330-
await Settings.change('codeFormatting.addWhitespaceAroundPipe', value, configurationTarget);
332+
await Settings.change(newSetting, value, configurationTarget);
331333
}
332334
}
333335

0 commit comments

Comments
 (0)