mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
unwrap lambda: ensure declaration is covered in preview (IDEA-201206)
This commit is contained in:
@@ -32,6 +32,12 @@ public class JavaLambdaUnwrapper extends JavaUnwrapper {
|
||||
return e instanceof PsiLambdaExpression;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement collectAffectedElements(@NotNull PsiElement e, @NotNull List<PsiElement> toExtract) {
|
||||
super.collectAffectedElements(e, toExtract);
|
||||
return JavaAnonymousUnwrapper.findElementToExtractFrom(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doUnwrap(PsiElement element, Context context) throws IncorrectOperationException {
|
||||
PsiElement from = JavaAnonymousUnwrapper.findElementToExtractFrom(element);
|
||||
|
||||
@@ -78,6 +78,16 @@ public class UnwrapLambdaTest extends UnwrapTestCase {
|
||||
"}\n", 1);
|
||||
}
|
||||
|
||||
public void testUnwrapAssignmentWithCodeBlock() throws Exception {
|
||||
assertUnwrapped("{\n" +
|
||||
" Runnable r = () -> {in<caret>t i = 0;};\n" +
|
||||
"}\n",
|
||||
|
||||
"{\n" +
|
||||
" int i = 0;\n" +
|
||||
"}\n");
|
||||
}
|
||||
|
||||
public void testUnwrapUnresolved() throws Exception {
|
||||
assertUnwrapped("{\n" +
|
||||
" () -> <caret>null;\n" +
|
||||
|
||||
Reference in New Issue
Block a user