From 124e1f72e93c90a9416431797adc2f5be66355a6 Mon Sep 17 00:00:00 2001 From: "Christoph Bergmeister [MVP]" Date: Wed, 20 Mar 2019 13:54:44 -0700 Subject: [PATCH 1/3] Add new powershell.codeFormatting settings for new options in PSSA 1.18: PipelineIndentationStyle (#1669) * Add powershell.codeformatting.pipelineIndentationStyle setting * fix indentation --- package.json | 10 ++++++++++ src/settings.ts | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/package.json b/package.json index bc7682a090..8289af0b5e 100644 --- a/package.json +++ b/package.json @@ -637,6 +637,16 @@ "default": true, "description": "Adds a newline (line break) after a closing brace." }, + "powershell.codeFormatting.pipelineIndentationStyle": { + "type": "string", + "enum": [ + "IncreaseIndentationForFirstPipeline", + "IncreaseIndentationAfterEveryPipeline", + "NoIndentation" + ], + "default": "IncreaseIndentationForFirstPipeline", + "description": "Multi-line pipeline style settings." + }, "powershell.codeFormatting.whitespaceBeforeOpenBrace": { "type": "boolean", "default": true, diff --git a/src/settings.ts b/src/settings.ts index c7a87ffef7..e8f6fc4a4f 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -14,6 +14,12 @@ enum CodeFormattingPreset { Stroustrup, } +enum PipelineIndentationStyle { + IncreaseIndentationForFirstPipeline, + IncreaseIndentationAfterEveryPipeline, + NoIndentation, +} + export enum HelpCompletion { Disabled = "Disabled", BlockComment = "BlockComment", @@ -39,6 +45,7 @@ export interface ICodeFormattingSettings { openBraceOnSameLine: boolean; newLineAfterOpenBrace: boolean; newLineAfterCloseBrace: boolean; + pipelineIndentationStyle: PipelineIndentationStyle; whitespaceBeforeOpenBrace: boolean; whitespaceBeforeOpenParen: boolean; whitespaceAroundOperator: boolean; @@ -125,6 +132,7 @@ export function load(): ISettings { openBraceOnSameLine: true, newLineAfterOpenBrace: true, newLineAfterCloseBrace: true, + pipelineIndentationStyle: PipelineIndentationStyle.IncreaseIndentationForFirstPipeline, whitespaceBeforeOpenBrace: true, whitespaceBeforeOpenParen: true, whitespaceAroundOperator: true, From 971f76604c4868e71b70b55be821c6ac7d9936dc Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt Date: Wed, 20 Mar 2019 13:54:05 -0700 Subject: [PATCH 2/3] Add new powershell.codeFormatting settings for new options in PSSA 1.18: WhitespaceInsideBrace and WhitespaceAroundPipe (#1668) * Add new settings: powershell.codeFormatting.WhitespaceInsideBrace and powershell.codeFormatting.WhitespaceAroundPipe * fix whitespace * Apply suggestions from code review --- package.json | 10 ++++++++++ src/settings.ts | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/package.json b/package.json index 8289af0b5e..422255f862 100644 --- a/package.json +++ b/package.json @@ -667,6 +667,16 @@ "default": true, "description": "Adds a space after a separator (',' and ';')." }, + "powershell.codeFormatting.WhitespaceInsideBrace": { + "type": "boolean", + "default": true, + "description": "Adds a space after an opening brace ('{') and before a closing brace ('}')." + }, + "powershell.codeFormatting.WhitespaceAroundPipe": { + "type": "boolean", + "default": true, + "description": "Adds a space before and after the pipeline operator ('|')." + }, "powershell.codeFormatting.ignoreOneLineBlock": { "type": "boolean", "default": true, diff --git a/src/settings.ts b/src/settings.ts index e8f6fc4a4f..d89514885c 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -50,6 +50,8 @@ export interface ICodeFormattingSettings { whitespaceBeforeOpenParen: boolean; whitespaceAroundOperator: boolean; whitespaceAfterSeparator: boolean; + WhitespaceInsideBrace: true; + WhitespaceAroundPipe: true; ignoreOneLineBlock: boolean; alignPropertyValuePairs: boolean; } @@ -137,6 +139,8 @@ export function load(): ISettings { whitespaceBeforeOpenParen: true, whitespaceAroundOperator: true, whitespaceAfterSeparator: true, + WhitespaceInsideBrace: true, + WhitespaceAroundPipe: true, ignoreOneLineBlock: true, alignPropertyValuePairs: true, }; From 86a7c237689975dfe13cdf1661e502caf74328ed Mon Sep 17 00:00:00 2001 From: "Christoph Bergmeister [MVP]" Date: Wed, 20 Mar 2019 13:53:34 -0700 Subject: [PATCH 3/3] Add new powershell.useCorrectCasingsettings for new rule in PSSA 1.18: PSUseCorrectCasing (#1687) * Add powershell.codeformatting.pipelineIndentationStyle setting * add UseCorrectCasing * Revert "Add powershell.codeformatting.pipelineIndentationStyle setting" This reverts commit a5487d7104c176ae6363744a988be9c0d303319a. * fix comma * Update package.json --- package.json | 5 +++++ src/settings.ts | 2 ++ 2 files changed, 7 insertions(+) diff --git a/package.json b/package.json index 422255f862..a8e7400871 100644 --- a/package.json +++ b/package.json @@ -687,6 +687,11 @@ "default": true, "description": "Align assignment statements in a hashtable or a DSC Configuration." }, + "powershell.codeFormatting.useCorrectCasing": { + "type": "boolean", + "default": true, + "description": "Use correct casing for cmdlets." + }, "powershell.integratedConsole.showOnStartup": { "type": "boolean", "default": true, diff --git a/src/settings.ts b/src/settings.ts index d89514885c..b12c9dfd77 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -54,6 +54,7 @@ export interface ICodeFormattingSettings { WhitespaceAroundPipe: true; ignoreOneLineBlock: boolean; alignPropertyValuePairs: boolean; + useCorrectCasing: boolean; } export interface IScriptAnalysisSettings { @@ -143,6 +144,7 @@ export function load(): ISettings { WhitespaceAroundPipe: true, ignoreOneLineBlock: true, alignPropertyValuePairs: true, + useCorrectCasing: true, }; const defaultIntegratedConsoleSettings: IIntegratedConsoleSettings = {