dotnet/roslyn
Extract method over-indents second line of expression
Ouverte
#21 453 ouverte le 11 août 2017
Area-IDEBugFeature - Extract MethodIDE-Formatterhelp wanted
Métriques du dépôt
- Stars
- (20 414 étoiles)
- Métriques de merge PR
- (Merge moyen 6j 17h) (256 PRs mergées en 30 j)
Description
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;
}
}
}