mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
extract method: do not include comments when they were not included in selection; leave assignment expressions untouched? (IDEA-72730 )
This commit is contained in:
+1
-1
@@ -201,7 +201,7 @@ public class ExtractMethodProcessor implements MatchProvider {
|
||||
myExpression = null;
|
||||
if (myElements.length == 1 && myElements[0] instanceof PsiExpression) {
|
||||
final PsiExpression expression = (PsiExpression)myElements[0];
|
||||
if (expression.getParent() instanceof PsiExpressionStatement) {
|
||||
if (expression instanceof PsiAssignmentExpression && expression.getParent() instanceof PsiExpressionStatement) {
|
||||
myElements[0] = expression.getParent();
|
||||
}
|
||||
else {
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class Test {
|
||||
void bar(){}
|
||||
void foo() {
|
||||
<selection>bar();</selection>//some comment here
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
void bar(){}
|
||||
void foo() {
|
||||
newMethod();//some comment here
|
||||
}
|
||||
|
||||
private void newMethod() {
|
||||
bar();
|
||||
}
|
||||
}
|
||||
@@ -124,6 +124,10 @@ public class ExtractMethodTest extends LightCodeInsightTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testLeaveCommentsWhenExpressionExtracted() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSCR15815() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user