show where the constants in class name completion come from

This commit is contained in:
peter
2011-08-17 16:41:22 +02:00
parent afa357adbd
commit 5d084bea63
2 changed files with 21 additions and 2 deletions
@@ -2,7 +2,8 @@ package com.intellij.codeInsight.completion;
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
import com.intellij.codeInsight.CodeInsightSettings
import com.intellij.util.ArrayUtil;
import com.intellij.util.ArrayUtil
import com.intellij.codeInsight.lookup.LookupElementPresentation;
/**
* @author peter
@@ -54,6 +55,24 @@ public class Foo {
class Bar {{ Foo.abcfield<caret> }}"""
}
public void testFieldNamePresentation() {
myFixture.addClass("""
package foo;
public class Foo {
public static int abcfield = 2
static final int fieldThatsNotVisible = 3
}
""")
myFixture.configureByText "a.java", "class Bar {{ abcf<caret> }}"
def element = myFixture.complete(CompletionType.CLASS_NAME)[0]
def presentation = new LookupElementPresentation()
element.renderElement(presentation)
assert 'Foo.abcfield' == presentation.itemText
assert ' (foo)' == presentation.tailText
assert 'int' == presentation.typeText
}
public void testQualifiedMethodName() throws Exception {
myFixture.addClass("""
package foo;