(Migrated from madskristensen/EditorConfigLanguage#11 on behalf of @RehanSaeed.)
The csharp_new_line_before_open_brace setting seems stuck on all
. I was going to raise this in the roslyn repo but thought it might be a tooling issue in VS 2017.
[*.cs]
csharp_new_line_before_open_brace = all:warning
class Foo {
}
all
and they all produce the same result.This is an incorrect specification of this option.
csharp_new_line_before_open_brace = all:warning
csharp_new_line_before_open_brace
can only have all or:
accessors
types
methods
properties
indexers
events
anonymous_methods
control_blocks
anonymous_types
object_collection_array_initalizers
lambdas
local_functions
The question is, what is the correct behavior in editor config when the user specifies an invalid option?
all
was an item in the editorconfig VS extension's intellisense. If it's not allowed, the original issue should be reopened. What is the syntax for specifying one or more options?
@RehanSaeed Ehm, I believe @jmarolf said that "all" _is_ a valid option, but not "all:warning". Is that correct? At least that works for me. (I've set the code formatting in the VS settings otherwise and override that with the EditorConfig option for the test.)
@ygoe Yes that seems to work. all:warning
not being allowed is the bug.
That is by design - we don't have an analyzer that allows warnings to be reported just for that single issue, and we probably won't.
What option to use if I don't want to have new line before open brace ?
Code example here
@dsoronda
If you don't want a newline before any open brace use the following
csharp_new_line_before_open_brace = none
csharp_new_line_before_catch = false
csharp_new_line_before_else = false
csharp_new_line_before_finally = false
csharp_new_line_before_members_in_anonymous_types = false
csharp_new_line_before_members_in_object_initializers = false
Thank you @jmarolf , it works now.
Just sidenote,
In one of your previous post here you enumerated options for csharp_new_line_before_open_brace
, and value NONE
is missing, as specified in documentation.
Cheers.
Most helpful comment
@ygoe Yes that seems to work.
all:warning
not being allowed is the bug.