Open sharwell opened 7 years ago
Tagging @heejaechang . This is a confluence of extract method + formatting. Can you let us know the best way to handle this?
formatter probably see this as code that is asked to be formatted
private static bool NewMethod(bool b)
{
returnb !=
[same as original code]true;
}
and then
private static bool NewMethod(bool b)
{
return b !=
[same as original code + return + indentation added to return]true;
}
this is happening since formatting tries to keep delta between "true" and "return".
I am not sure whether formatter can fix it themselves in general way, feature probably need to recognize the case and explicitly tell formatter what to do either through rule or explicitly playing with trivia.
Version Used: 15.3 Preview 7
:link: Originally revealed by
ExtractMethodTests.TestUseExpressionWhenOnSingleLine_AndNotIsOnSingleLine
in #21439.Steps to Reproduce:
Use the following code
Select
b != true
Apply the Extract Method refactoring
Expected Behavior:
Actual Behavior: