mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
introduce functional variable: allow comments (IDEA-174183)
This commit is contained in:
+1
-1
@@ -60,7 +60,7 @@ public class IntroduceFunctionalVariableHandler extends IntroduceVariableHandler
|
||||
showErrorMessage(project , editor, message);
|
||||
return;
|
||||
}
|
||||
PsiElement anchorStatement = RefactoringUtil.getParentStatement(elements[0], false);
|
||||
PsiElement anchorStatement = elements[0] instanceof PsiComment ? elements[0] : RefactoringUtil.getParentStatement(elements[0], false);
|
||||
PsiElement tempContainer = checkAnchorStatement(project, editor, anchorStatement);
|
||||
if (tempContainer == null) return;
|
||||
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class Test {
|
||||
{
|
||||
Runnable runnable = () -> {
|
||||
//my comment
|
||||
};
|
||||
runnable.run();
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class Test {
|
||||
{
|
||||
<selection>//my comment</selection>
|
||||
}
|
||||
}
|
||||
+4
@@ -63,6 +63,10 @@ public class IntroduceFunctionalVariableTest extends LightRefactoringTestCase {
|
||||
doTest(0);
|
||||
}
|
||||
|
||||
public void testRunnableFromComment() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testIgnoreMethodObjectSuggestion() throws Exception {
|
||||
try {
|
||||
doTest();
|
||||
|
||||
Reference in New Issue
Block a user