Reporter |
|
---|---|
Created | Apr 10, 2018 2:39:35 PM |
Updated | Apr 10, 2018 2:53:19 PM |
Subsystem | Code Style - Formatter |
Assignee | Dmitry Osinovsky (Dmitry.Osinovsky) |
Priority | Major |
State | Submitted |
Type | Feature |
Fix version | Backlog |
Affected versions | 2017.3.5 |
Fixed In Version ReSharper | Undefined |
VsVersion | All Versions |
in C#: Treat a simple assignment switch block as "simple"
i.e. allow reformatting as follows:
Currently only a "return value" is recognised as a simple case statement. Currently, the above code is always re-formatted with the break on a new line - which I do not want in this simple case.
(It would be appropriate to consider the choices when the line length exceeds the wrap margin).
There are two considerations here: allign the simple statement (or not); align the break statements (or not).
i.e. allow reformatting as follows:
private string demo(int v)
{
string rc = string.Empty;
switch(v)
{
case 1: rc = "One"; break;
case 11: rc = "Elevent"; break;
case 101: rc = "One hundred and one"; break;
}
DoSomethingWithValue(rc);
return rc;
}
Currently only a "return value" is recognised as a simple case statement. Currently, the above code is always re-formatted with the break on a new line - which I do not want in this simple case.
(It would be appropriate to consider the choices when the line length exceeds the wrap margin).
There are two considerations here: allign the simple statement (or not); align the break statements (or not).