mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
display type arguments in java completion suggestions (IDEA-143204)
This commit is contained in:
+1
-1
@@ -205,7 +205,7 @@ class TypeArgumentCompletionProvider extends CompletionProvider<CompletionParame
|
||||
myLookupString = StringUtil.join(myTypeItems, new Function<PsiTypeLookupItem, String>() {
|
||||
@Override
|
||||
public String fun(PsiTypeLookupItem item) {
|
||||
return item.getLookupString();
|
||||
return item.getType().getPresentableText();
|
||||
}
|
||||
}, ", ");
|
||||
}
|
||||
|
||||
@@ -73,11 +73,13 @@ public class PsiTypeLookupItem extends LookupItem implements TypedLookupItem {
|
||||
@Override
|
||||
public PsiType getType() {
|
||||
Object object = getObject();
|
||||
PsiType type = object instanceof PsiType ? (PsiType)object : JavaPsiFacade.getElementFactory(((PsiClass) object).getProject()).createType((PsiClass)object);
|
||||
PsiType type = object instanceof PsiType
|
||||
? getSubstitutor().substitute((PsiType)object)
|
||||
: JavaPsiFacade.getElementFactory(((PsiClass) object).getProject()).createType((PsiClass)object, getSubstitutor());
|
||||
for (int i = 0; i < getBracketsCount(); i++) {
|
||||
type = new PsiArrayType(type);
|
||||
}
|
||||
return getSubstitutor().substitute(type);
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import java.util.HashMap;
|
||||
import java.util.*;
|
||||
|
||||
public class A {
|
||||
private HashMap<String, String> m = new HashMap<St<caret>>()
|
||||
private HashMap<String, List<String>> m = new HashMap<St<caret>>()
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import java.util.HashMap;
|
||||
import java.util.*;
|
||||
|
||||
public class A {
|
||||
private HashMap<String, String> m = new HashMap<String, String>(<caret>)
|
||||
private HashMap<String, List<String>> m = new HashMap<String, List<String>>(<caret>)
|
||||
}
|
||||
|
||||
+2
-1
@@ -696,8 +696,9 @@ interface TxANotAnno {}
|
||||
}
|
||||
|
||||
public void testPreferValueTypesReturnedFromMethod() {
|
||||
checkPreferredItems 0, 'StringBuffer', 'String', 'Serializable', 'SomeInterface', 'SomeOtherClass'
|
||||
checkPreferredItems 0, 'StringBuffer', 'String', 'Serializable', 'SomeInterface', 'SomeInterface', 'SomeOtherClass'
|
||||
assert 'SomeInterface<String>' == LookupElementPresentation.renderElement(myFixture.lookupElements[3]).itemText
|
||||
assert 'SomeInterface' == LookupElementPresentation.renderElement(myFixture.lookupElements[4]).itemText
|
||||
}
|
||||
|
||||
public void testPreferCastTypesHavingSpecifiedMethod() {
|
||||
|
||||
+2
-1
@@ -1324,7 +1324,8 @@ class XInternalError {}
|
||||
|
||||
public void testSuggestAllTypeArguments() {
|
||||
configure()
|
||||
assert 'String, String' == lookup.items[0].lookupString
|
||||
assert 'String, List<String>' == lookup.items[0].lookupString
|
||||
assert 'String, List<String>' == LookupElementPresentation.renderElement(lookup.items[0]).itemText
|
||||
type '\n'
|
||||
checkResult()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user