mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix completion context to collapse to diamonds (IDEA-169491)
This commit is contained in:
@@ -159,7 +159,7 @@ public class JavaInheritorsGetter extends CompletionProvider<CompletionParameter
|
||||
}
|
||||
try {
|
||||
final PsiStatement statement = elementFactory
|
||||
.createStatementFromText(canonicalText + " v = new " + erasedText + "<>()", parameters.getOriginalFile());
|
||||
.createStatementFromText(canonicalText + " v = new " + erasedText + "<>()", parameters.getPosition());
|
||||
final PsiVariable declaredVar = (PsiVariable)((PsiDeclarationStatement)statement).getDeclaredElements()[0];
|
||||
final PsiNewExpression initializer = (PsiNewExpression)declaredVar.getInitializer();
|
||||
final boolean hasDefaultConstructorOrNoGenericsOne = PsiDiamondTypeImpl.hasDefaultConstructor(psiClass) ||
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import java.util.ArrayList;
|
||||
|
||||
class Test {
|
||||
|
||||
<T> ArrayList<T> foo () {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import java.util.ArrayList;
|
||||
|
||||
class Test {
|
||||
|
||||
<T> ArrayList<T> foo () {
|
||||
return new Arr<caret>
|
||||
}
|
||||
}
|
||||
+4
@@ -42,6 +42,10 @@ public class SmartType17CompletionTest extends LightFixtureCompletionTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testDiamondCollapsedWithMethodTypeParameter() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testDiamondNotCollapsed() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user