diff --git a/src/PowerShellEditorServices.Protocol/Server/LanguageServerSettings.cs b/src/PowerShellEditorServices.Protocol/Server/LanguageServerSettings.cs index cee52d904..7426b7a61 100644 --- a/src/PowerShellEditorServices.Protocol/Server/LanguageServerSettings.cs +++ b/src/PowerShellEditorServices.Protocol/Server/LanguageServerSettings.cs @@ -141,6 +141,27 @@ public enum CodeFormattingPreset Stroustrup } + /// + /// Multi-line pipeline style settings. + /// + public enum PipelineIndentationStyle + { + /// + /// After the indentation level only once after the first pipeline and keep this level for the following pipelines. + /// + IncreaseIndentationForFirstPipeline, + + /// + /// After every pipeline, keep increasing the indentation. + /// + IncreaseIndentationAfterEveryPipeline, + + /// + /// Do not increase indentation level at all after pipeline. + /// + NoIndentation + } + public class CodeFormattingSettings { /// @@ -172,12 +193,16 @@ public CodeFormattingSettings(CodeFormattingSettings codeFormattingSettings) public bool OpenBraceOnSameLine { get; set; } public bool NewLineAfterOpenBrace { get; set; } public bool NewLineAfterCloseBrace { get; set; } + public PipelineIndentationStyle PipelineIndentationStyle { get; set; } public bool WhitespaceBeforeOpenBrace { get; set; } public bool WhitespaceBeforeOpenParen { get; set; } public bool WhitespaceAroundOperator { get; set; } public bool WhitespaceAfterSeparator { get; set; } + public bool WhitespaceInsideBrace { get; set; } + public bool WhitespaceAroundPipe { get; set; } public bool IgnoreOneLineBlock { get; set; } public bool AlignPropertyValuePairs { get; set; } + public bool UseCorrectCasing { get; set; } /// @@ -247,6 +272,7 @@ private Hashtable GetCustomPSSASettingsHashtable(int tabSize, bool insertSpaces) {"PSUseConsistentIndentation", new Hashtable { {"Enable", true}, {"IndentationSize", tabSize}, + {"PipelineIndentation", PipelineIndentationStyle }, {"Kind", insertSpaces ? "space" : "tab"} }}, {"PSUseConsistentWhitespace", new Hashtable { @@ -254,12 +280,17 @@ private Hashtable GetCustomPSSASettingsHashtable(int tabSize, bool insertSpaces) {"CheckOpenBrace", WhitespaceBeforeOpenBrace}, {"CheckOpenParen", WhitespaceBeforeOpenParen}, {"CheckOperator", WhitespaceAroundOperator}, - {"CheckSeparator", WhitespaceAfterSeparator} + {"CheckSeparator", WhitespaceAfterSeparator}, + {"CheckInnerBrace", WhitespaceInsideBrace}, + {"CheckPipe", WhitespaceAroundPipe}, }}, {"PSAlignAssignmentStatement", new Hashtable { {"Enable", true}, {"CheckHashtable", AlignPropertyValuePairs} }}, + {"PSUseCorrectCasing", new Hashtable { + {"Enable", true} + }}, }} }; }