dotnet/roslyn

WrappingKeepStatementsOnSingleLine and WrappingPreserveSingleLine conflicts editor config settings

Aberta

#45.570 aberto em 30 de jun. de 2020

 (0 comentário) (0 reação) (0 responsável)C# (4.257 forks)batch import
Area-IDEBugIDE-Formatterhelp wanted

Métricas do repositório

Stars
 (20.414 estrelas)
Métricas de merge de PR
 (Mesclagem média 6d 17h) (256 fundiu PRs em 30d)

Description

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.

Guia do colaborador