dotnet/roslyn

WrappingKeepStatementsOnSingleLine and WrappingPreserveSingleLine conflicts editor config settings

オープン

#45,570 opened on 2020/06/30

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)C# (4,257 件のフォーク)batch import
Area-IDEBugIDE-Formatterhelp wanted

Repository metrics

Stars
 (20,414 個のスター)
PR merge metrics
 (平均マージ 6d 17h) (30d で 256 merged PRs)

説明

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.

コントリビューターガイド