mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
invite to type type parameters when completing new Callable
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.codeInsight.AutoPopupController;
|
||||
import com.intellij.codeInsight.generation.GenerateMembersUtil;
|
||||
import com.intellij.codeInsight.generation.OverrideImplementUtil;
|
||||
import com.intellij.codeInsight.generation.PsiGenerationInfo;
|
||||
@@ -141,17 +142,9 @@ class ConstructorInsertHandler implements InsertHandler<LookupElementDecorator<L
|
||||
}
|
||||
}
|
||||
|
||||
int identifierEnd = context.getTailOffset();
|
||||
|
||||
JavaCompletionUtil.insertParentheses(context, delegate, false, hasParams, forAnonymous);
|
||||
|
||||
if (context.getCompletionChar() == '<') {
|
||||
context.getDocument().insertString(identifierEnd, "<>");
|
||||
context.setAddCompletionChar(false);
|
||||
context.getEditor().getCaretModel().moveToOffset(identifierEnd + 1);
|
||||
}
|
||||
|
||||
return hasParams;
|
||||
return true;
|
||||
}
|
||||
|
||||
private static Runnable generateAnonymousBody(final Editor editor, final PsiFile file) {
|
||||
|
||||
@@ -85,11 +85,14 @@ class JavaClassNameInsertHandler implements InsertHandler<JavaPsiClassReferenceE
|
||||
|
||||
OffsetKey refEnd = context.trackOffset(context.getTailOffset(), false);
|
||||
|
||||
boolean fillTypeArgs = false;
|
||||
boolean fillTypeArgs = context.getCompletionChar() == '<';
|
||||
if (fillTypeArgs) {
|
||||
context.setAddCompletionChar(false);
|
||||
}
|
||||
|
||||
if (shouldInsertParentheses(psiClass, position)) {
|
||||
if (ConstructorInsertHandler.insertParentheses(context, item, psiClass, false)) {
|
||||
fillTypeArgs = psiClass.hasTypeParameters() && PsiUtil.getLanguageLevel(file).isAtLeast(LanguageLevel.JDK_1_5);
|
||||
AutoPopupController.getInstance(project).autoPopupParameterInfo(editor, null);
|
||||
fillTypeArgs |= psiClass.hasTypeParameters() && PsiUtil.getLanguageLevel(file).isAtLeast(LanguageLevel.JDK_1_5);
|
||||
}
|
||||
}
|
||||
else if (insertingAnnotationWithParameters(context, item)) {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
public class Driver {
|
||||
{
|
||||
new Fooo<caret>
|
||||
}
|
||||
}
|
||||
|
||||
interface Foooo<T> {
|
||||
void bar();
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
public class Driver {
|
||||
{
|
||||
new Foooo<<caret>>()
|
||||
}
|
||||
}
|
||||
|
||||
interface Foooo<T> {
|
||||
void bar();
|
||||
}
|
||||
@@ -916,6 +916,8 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase {
|
||||
|
||||
public void testMethodParameterTypeDot() throws Throwable { doAntiTest() }
|
||||
public void testNewGenericClass() throws Throwable { doTest('\n') }
|
||||
public void testNewGenericInterface() throws Throwable { doTest() }
|
||||
//public void testUnfinishedMethodTypeParameter() throws Throwable { doTest() }
|
||||
|
||||
public void testSuperProtectedMethod() throws Throwable {
|
||||
myFixture.addClass """package foo;
|
||||
|
||||
Reference in New Issue
Block a user