dotnet/roslyn

WrappingKeepStatementsOnSingleLine and WrappingPreserveSingleLine conflicts editor config settings

开放

#45,570 创建于 2020年6月30日

 (0 条评论) (0 个反应) (0 位负责人)C# (4,257 个派生)batch import
Area-IDEBugIDE-Formatterhelp wanted

仓库指标

星标
 (20,414 个星标)
PR 合并指标
 (平均合并 6天 17小时) (30 天内合并 256 个 PR)

描述

Version Used: Roslyn in Visual Studio Internal Preview 4

Steps to Reproduce:

Format an if statement with curly brace on the same line as the conditional like this:

if (true) {
    Console.WriteLine("Test");
}

With options configured like so:

var options = workspace.Options
    .WithChangedOption(CSharpFormattingOptions.WrappingKeepStatementsOnSingleLine, false)
    .WithChangedOption(CSharpFormattingOptions.WrappingPreserveSingleLine, false);

And in a project with an editor config containing:

csharp_new_line_before_open_brace = none

Expected Behavior: Curly brace will be on the same line as the conditional after formatting.

Actual Behavior: Curly brace is placed on a new line ignoring the editor config file settings.

贡献者指南