dotnet/roslyn
Extract method over-indents second line of expression
Offen
#21.453 geöffnet am 11.08.2017
Area-IDEBugFeature - Extract MethodIDE-Formatterhelp wanted
Repository-Metriken
- Stars
- (20.414 Sterne)
- PR-Merge-Metriken
- (Durchschn. Merge 6T 17h) (256 gemergte PRs in 30 T)
Beschreibung
Version Used: 15.3 Preview 7
:link: Originally revealed by ExtractMethodTests.TestUseExpressionWhenOnSingleLine_AndNotIsOnSingleLine in #21439.
Steps to Reproduce:
-
Use the following code
using System; namespace ConsoleApp5 { class Program { static void Main(string[] args) { bool b = true; Console.WriteLine(b != true ? b = true : b = false); } } } -
Select
b != true -
Apply the Extract Method refactoring
Expected Behavior:
using System;
namespace ConsoleApp5
{
class Program
{
static void Main(string[] args)
{
bool b = true;
Console.WriteLine(NewMethod(b) ? b = true : b = false);
}
private static bool NewMethod(bool b)
{
return b !=
true;
}
}
}
Actual Behavior:
using System;
namespace ConsoleApp5
{
class Program
{
static void Main(string[] args)
{
bool b = true;
Console.WriteLine(NewMethod(b) ? b = true : b = false);
}
private static bool NewMethod(bool b)
{
return b !=
true;
}
}
}