mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-54459 Smart type completion for anonymous class after 'new' inserts '{}' inside '()' if the class has two generic parameters
This commit is contained in:
@@ -18,6 +18,7 @@ import com.intellij.openapi.editor.ScrollType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.CodeStyleManager;
|
||||
import com.intellij.psi.impl.source.PostprocessReformattingAspect;
|
||||
import com.intellij.psi.infos.CandidateInfo;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
@@ -53,6 +54,8 @@ class ConstructorInsertHandler implements InsertHandler<LookupElementDecorator<L
|
||||
if (psiClass.hasModifierProperty(PsiModifier.ABSTRACT) || psiClass.isInterface()) {
|
||||
FeatureUsageTracker.getInstance().triggerFeatureUsed("editing.completion.smarttype.anonymous");
|
||||
|
||||
PostprocessReformattingAspect.getInstance(context.getProject()).doPostponedFormatting(context.getFile().getViewProvider());
|
||||
|
||||
final Editor editor = context.getEditor();
|
||||
final int offset = context.getTailOffset();
|
||||
editor.getDocument().insertString(offset, " {}");
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
interface Function<X, Y> { }
|
||||
class A {
|
||||
private static final Function<String, String> a = new Function<String, String>() {
|
||||
<caret>};
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
interface Function<X, Y> { }
|
||||
class A {
|
||||
private static final Function<String, String> a = new <caret>
|
||||
}
|
||||
+2
@@ -633,6 +633,8 @@ public class SmartTypeCompletionTest extends LightCompletionTestCase {
|
||||
|
||||
public void testDefaultAnnoMethodValue() throws Throwable { doTest(); }
|
||||
|
||||
public void testNewAnonymousFunction() throws Throwable { doTest(); }
|
||||
|
||||
public void testUseIntConstantsFromTargetClass() throws Throwable { doTest(); }
|
||||
public void testUseIntConstantsFromTargetClassReturnValue() throws Throwable { doTest(); }
|
||||
public void testUseIntConstantsFromConstructedClass() throws Throwable { doTest(); }
|
||||
|
||||
Reference in New Issue
Block a user