mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
IDEA-91842 Type parameters are shown for field but not for method
This commit is contained in:
@@ -64,7 +64,7 @@ public class VariableLookupItem extends LookupItem<PsiVariable> implements Typed
|
||||
public void renderElement(LookupElementPresentation presentation) {
|
||||
super.renderElement(presentation);
|
||||
if (myHelper != null) {
|
||||
myHelper.renderElement(presentation, getAttribute(FORCE_QUALIFY) != null ? Boolean.TRUE : null, PsiSubstitutor.EMPTY);
|
||||
myHelper.renderElement(presentation, getAttribute(FORCE_QUALIFY) != null ? Boolean.TRUE : null, getSubstitutor());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.codeInsight.completion.JavaCompletionUtil;
|
||||
import com.intellij.codeInsight.lookup.DefaultLookupItemRenderer;
|
||||
import com.intellij.codeInsight.lookup.LookupElementPresentation;
|
||||
import com.intellij.codeInsight.lookup.LookupItem;
|
||||
import com.intellij.codeInsight.lookup.VariableLookupItem;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.beanProperties.BeanPropertyElement;
|
||||
@@ -90,7 +91,11 @@ public class JavaElementLookupRenderer implements ElementLookupRenderer {
|
||||
if (element.isValid()) {
|
||||
if (element instanceof PsiVariable){
|
||||
PsiVariable variable = (PsiVariable)element;
|
||||
text = variable.getType().getPresentableText();
|
||||
PsiType type = variable.getType();
|
||||
if (item instanceof VariableLookupItem) {
|
||||
type = ((VariableLookupItem)item).getSubstitutor().substitute(type);
|
||||
}
|
||||
text = type.getPresentableText();
|
||||
}
|
||||
else if (element instanceof PsiExpression){
|
||||
PsiExpression expression = (PsiExpression)element;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
class Ref<T> {
|
||||
T target;
|
||||
}
|
||||
|
||||
class TestPoint2D {
|
||||
void (Ref<String> r) {
|
||||
r.<caret>
|
||||
|
||||
}
|
||||
}
|
||||
@@ -97,9 +97,15 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase {
|
||||
}
|
||||
|
||||
private LookupElementPresentation renderElement(LookupElement element) {
|
||||
def presentation = new LookupElementPresentation()
|
||||
element.renderElement(presentation)
|
||||
return presentation
|
||||
return LookupElementPresentation.renderElement(element)
|
||||
}
|
||||
|
||||
public void testFieldItemPresentationGenerics() {
|
||||
configure()
|
||||
LookupElementPresentation presentation = renderElement(myItems[0])
|
||||
assert "target" == presentation.itemText
|
||||
assert !presentation.tailText
|
||||
assert "String" == presentation.typeText
|
||||
}
|
||||
|
||||
public void testMethodItemPresentationGenerics() {
|
||||
|
||||
Reference in New Issue
Block a user