dotnet/roslyn
Extract method over-indents second line of expression
Aperta
#21.453 aperta il 11 ago 2017
Area-IDEBugFeature - Extract MethodIDE-Formatterhelp wanted
Metriche repository
- Star
- (20.414 stelle)
- Metriche merge PR
- (Merge medio 6g 17h) (256 PR mergiate in 30 g)
Descrizione
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;
}
}
}