From 3831db84f80589806d0f8b9adade86e624d0dd5c Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Thu, 30 Apr 2020 20:42:17 +0100 Subject: [PATCH 1/3] PSSA 1.19.0 settings support --- package.json | 14 ++++++++++++-- src/settings.ts | 8 +++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index bf9acc85ea..315e6c66bd 100644 --- a/package.json +++ b/package.json @@ -686,10 +686,20 @@ "default": true, "description": "Adds a space after an opening brace ('{') and before a closing brace ('}')." }, - "powershell.codeFormatting.whitespaceAroundPipe": { + "powershell.codeFormatting.whitespaceBetweenParameters": { + "type": "boolean", + "default": false, + "description": "Removes redundant whitespace between parameters." + }, + "powershell.codeFormatting.addWhitespaceAroundPipe": { "type": "boolean", "default": true, - "description": "Adds a space before and after the pipeline operator ('|')." + "description": "Adds a space before and after the pipeline operator ('|') if it is missing." + }, + "powershell.codeFormatting.trimWhitespaceAroundPipe": { + "type": "boolean", + "default": false, + "description": "Trims extraneous whitespace (more than 1 character) before and after the pipeline operator ('|')." }, "powershell.codeFormatting.ignoreOneLineBlock": { "type": "boolean", diff --git a/src/settings.ts b/src/settings.ts index fdaacab742..84426df3fd 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -51,8 +51,9 @@ export interface ICodeFormattingSettings { whitespaceBeforeOpenParen: boolean; whitespaceAroundOperator: boolean; whitespaceAfterSeparator: boolean; - whitespaceInsideBrace: true; - whitespaceAroundPipe: true; + whitespaceInsideBrace: boolean; + addWhitespaceAroundPipe: boolean; + trimWhitespaceAroundPipe: boolean; ignoreOneLineBlock: boolean; alignPropertyValuePairs: boolean; useCorrectCasing: boolean; @@ -164,7 +165,8 @@ export function load(): ISettings { whitespaceAroundOperator: true, whitespaceAfterSeparator: true, whitespaceInsideBrace: true, - whitespaceAroundPipe: true, + addWhitespaceAroundPipe: true, + trimWhitespaceAroundPipe: false, ignoreOneLineBlock: true, alignPropertyValuePairs: true, useCorrectCasing: false, From d145daad546aed55a068b372311c555f69405f2a Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Thu, 30 Apr 2020 21:18:10 +0100 Subject: [PATCH 2/3] add whitespaceBetweenParameters and change default pipeline indentation to None --- src/settings.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/settings.ts b/src/settings.ts index 84426df3fd..a5f4cbd51e 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -18,6 +18,7 @@ enum PipelineIndentationStyle { IncreaseIndentationForFirstPipeline, IncreaseIndentationAfterEveryPipeline, NoIndentation, + None, } export enum HelpCompletion { @@ -51,6 +52,7 @@ export interface ICodeFormattingSettings { whitespaceBeforeOpenParen: boolean; whitespaceAroundOperator: boolean; whitespaceAfterSeparator: boolean; + whitespaceBetweenParameters: boolean; whitespaceInsideBrace: boolean; addWhitespaceAroundPipe: boolean; trimWhitespaceAroundPipe: boolean; @@ -159,11 +161,12 @@ export function load(): ISettings { openBraceOnSameLine: true, newLineAfterOpenBrace: true, newLineAfterCloseBrace: true, - pipelineIndentationStyle: PipelineIndentationStyle.NoIndentation, + pipelineIndentationStyle: PipelineIndentationStyle.None, whitespaceBeforeOpenBrace: true, whitespaceBeforeOpenParen: true, whitespaceAroundOperator: true, whitespaceAfterSeparator: true, + whitespaceBetweenParameters: false, whitespaceInsideBrace: true, addWhitespaceAroundPipe: true, trimWhitespaceAroundPipe: false, From 21ba4507f46ac0737f9b20f80e2dcee264e22c9e Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Thu, 30 Apr 2020 22:56:21 +0100 Subject: [PATCH 3/3] add None option and set default --- package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 315e6c66bd..b151767da3 100644 --- a/package.json +++ b/package.json @@ -656,10 +656,11 @@ "enum": [ "IncreaseIndentationForFirstPipeline", "IncreaseIndentationAfterEveryPipeline", - "NoIndentation" + "NoIndentation", + "None" ], - "default": "NoIndentation", - "description": "Multi-line pipeline style settings." + "default": "None", + "description": "Multi-line pipeline style settings (default: None)." }, "powershell.codeFormatting.whitespaceBeforeOpenBrace": { "type": "boolean",