KT-738 No kotlin type completion in extend class scope - Fixes after CR-KT-13 review

This commit is contained in:
Nikolay Krasko
2011-12-05 13:14:41 +04:00
parent 65fb8d40b7
commit 49f0947c05
5 changed files with 8 additions and 19 deletions
@@ -78,7 +78,6 @@ class JetSimpleNameReference extends JetPsiReference {
private Object[] collectLookupElements(BindingContext bindingContext, JetScope scope) {
List<LookupElement> result = Lists.newArrayList();
for (final DeclarationDescriptor descriptor : scope.getAllDescriptors()) {
PsiElement declaration = bindingContext.get(BindingContext.DESCRIPTOR_TO_DECLARATION, descriptor.getOriginal());
LookupElementBuilder element = LookupElementBuilder.create(descriptor.getName());
String typeText = "";
String tailText = "";
@@ -107,9 +106,12 @@ class JetSimpleNameReference extends JetPsiReference {
typeText = DescriptorRenderer.TEXT.render(descriptor);
}
element = element.setTailText(tailText, tailTextGrayed).setTypeText(typeText);
PsiElement declaration = bindingContext.get(BindingContext.DESCRIPTOR_TO_DECLARATION, descriptor.getOriginal());
if (declaration != null) {
element = element.setIcon(declaration.getIcon(Iconable.ICON_FLAG_OPEN | Iconable.ICON_FLAG_VISIBILITY));
}
result.add(element);
}
return result.toArray();