diff --git a/CHANGELOG.md b/CHANGELOG.md index 73d56b18ab..741a97ca2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All changes to the project will be documented in this file. ## [1.32.9] - not yet released * Updated to Roslyn 2.10.0 (PR: [#1344](https://github.com/OmniSharp/omnisharp-roslyn/pull/1344)) +* Incorporate *IndentSwitchCaseSectionWhenBlock* into OmniSharp's formatting options. This fixes the default formatting behavior, as the setting is set to *true* by default, and still allows users to disable it if needed. ([#1351](https://github.com/OmniSharp/omnisharp-roslyn/issues/1351), PR: [#1353](https://github.com/OmniSharp/omnisharp-roslyn/pull/1353)) ## [1.32.8] - 2018-11-14 * Fixed MSBuild discovery path (1.32.7 regression) (PR: [#1337](https://github.com/OmniSharp/omnisharp-roslyn/pull/1337)) diff --git a/src/OmniSharp.Abstractions/Options/FormattingOptions.cs b/src/OmniSharp.Abstractions/Options/FormattingOptions.cs index b5b34cc335..f80bdc3219 100644 --- a/src/OmniSharp.Abstractions/Options/FormattingOptions.cs +++ b/src/OmniSharp.Abstractions/Options/FormattingOptions.cs @@ -38,6 +38,7 @@ public FormattingOptions() IndentBlock = true; IndentSwitchSection = true; IndentSwitchCaseSection = true; + IndentSwitchCaseSectionWhenBlock = true; LabelPositioning = "oneLess"; WrappingPreserveSingleLine = true; WrappingKeepStatementsOnSingleLine = true; @@ -122,6 +123,8 @@ public FormattingOptions() public bool IndentSwitchCaseSection { get; set; } + public bool IndentSwitchCaseSectionWhenBlock { get; set; } + public string LabelPositioning { get; set; } public bool WrappingPreserveSingleLine { get; set; } diff --git a/src/OmniSharp.Roslyn.CSharp/Services/CSharpWorkspaceOptionsProvider.cs b/src/OmniSharp.Roslyn.CSharp/Services/CSharpWorkspaceOptionsProvider.cs index b99c3e88d7..497cd8dc82 100644 --- a/src/OmniSharp.Roslyn.CSharp/Services/CSharpWorkspaceOptionsProvider.cs +++ b/src/OmniSharp.Roslyn.CSharp/Services/CSharpWorkspaceOptionsProvider.cs @@ -46,6 +46,7 @@ private static OptionSet GetOptions(OptionSet optionSet, FormattingOptions forma .WithChangedOption(CSharpFormattingOptions.IndentBlock, formattingOptions.IndentBlock) .WithChangedOption(CSharpFormattingOptions.IndentSwitchSection, formattingOptions.IndentSwitchSection) .WithChangedOption(CSharpFormattingOptions.IndentSwitchCaseSection, formattingOptions.IndentSwitchCaseSection) + .WithChangedOption(CSharpFormattingOptions.IndentSwitchCaseSectionWhenBlock, formattingOptions.IndentSwitchCaseSectionWhenBlock) .WithChangedOption(CSharpFormattingOptions.LabelPositioning, LabelPositionOptionForStringValue(formattingOptions.LabelPositioning)) .WithChangedOption(CSharpFormattingOptions.WrappingPreserveSingleLine, formattingOptions.WrappingPreserveSingleLine) .WithChangedOption(CSharpFormattingOptions.WrappingKeepStatementsOnSingleLine, formattingOptions.WrappingKeepStatementsOnSingleLine) @@ -97,4 +98,4 @@ public OptionSet Process(OptionSet workOptionSet, FormattingOptions options) return GetOptions(workOptionSet, options); } } -} \ No newline at end of file +}