mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
avoid completing new HashSet<String><String>();
This commit is contained in:
@@ -77,6 +77,19 @@ public class ConstructorInsertHandler implements InsertHandler<LookupElementDeco
|
||||
psiClass.getTypeParameters().length > 0 &&
|
||||
((PsiTypeLookupItem)delegate).calcGenerics(position, context).isEmpty() &&
|
||||
context.getCompletionChar() != '(';
|
||||
|
||||
if (context.getDocument().getTextLength() > context.getTailOffset() &&
|
||||
context.getDocument().getCharsSequence().charAt(context.getTailOffset()) == '<') {
|
||||
PsiJavaCodeReferenceElement ref = PsiTreeUtil.findElementOfClassAtOffset(context.getFile(), context.getTailOffset(), PsiJavaCodeReferenceElement.class, false);
|
||||
if (ref != null) {
|
||||
PsiReferenceParameterList parameterList = ref.getParameterList();
|
||||
if (parameterList != null && context.getTailOffset() == parameterList.getTextRange().getStartOffset()) {
|
||||
context.getDocument().deleteString(parameterList.getTextRange().getStartOffset(), parameterList.getTextRange().getEndOffset());
|
||||
context.commitDocument();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delegate.handleInsert(context);
|
||||
PostprocessReformattingAspect.getInstance(context.getProject()).doPostponedFormatting(context.getFile().getViewProvider());
|
||||
}
|
||||
@@ -85,6 +98,7 @@ public class ConstructorInsertHandler implements InsertHandler<LookupElementDeco
|
||||
PsiTypeLookupItem.addImportForItem(context, psiClass);
|
||||
}
|
||||
|
||||
|
||||
insertParentheses(context, delegate, psiClass, !inAnonymous && isAbstract);
|
||||
|
||||
if (inAnonymous) {
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
class Bar {
|
||||
{
|
||||
Koo<String> hs = new Ko<caret><StringX>();
|
||||
}
|
||||
}
|
||||
class Koo<X> {}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class Bar {
|
||||
{
|
||||
Koo<String> hs = new Koo<String>()<caret>;
|
||||
}
|
||||
}
|
||||
class Koo<X> {}
|
||||
+1
@@ -1339,6 +1339,7 @@ public class ListUtils {
|
||||
public void testInterfaceImplementationNoCast() { doTest() }
|
||||
public void testStaticallyImportedMethodsBeforeExpression() { doTest() }
|
||||
public void testInnerChainedReturnType() { doTest() }
|
||||
public void testOverwriteGenericsAfterNew() { doTest('\n') }
|
||||
|
||||
private CommonCodeStyleSettings getCodeStyleSettings() {
|
||||
return CodeStyleSettingsManager.getSettings(getProject()).getCommonSettings(JavaLanguage.INSTANCE);
|
||||
|
||||
Reference in New Issue
Block a user