mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
enable stats for class name completion in some qualifier
This commit is contained in:
@@ -88,6 +88,11 @@ public class JavaCompletionUtil {
|
||||
static final NullableLazyKey<ExpectedTypeInfo[], CompletionLocation> EXPECTED_TYPES = NullableLazyKey.create("expectedTypes", new NullableFunction<CompletionLocation, ExpectedTypeInfo[]>() {
|
||||
@Nullable
|
||||
public ExpectedTypeInfo[] fun(final CompletionLocation location) {
|
||||
if (PsiJavaPatterns.psiElement().beforeLeaf(PsiJavaPatterns.psiElement().withText("."))
|
||||
.accepts(location.getCompletionParameters().getPosition())) {
|
||||
return new ExpectedTypeInfo[0];
|
||||
}
|
||||
|
||||
return JavaSmartCompletionContributor.getExpectedTypes(location.getCompletionParameters());
|
||||
}
|
||||
});
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
public class MyFirstTestClassFoo {
|
||||
|
||||
int foo() {
|
||||
return FooB<caret>.fff().zoo();
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -139,4 +139,14 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase {
|
||||
assertEquals(2, ((PsiMethod)myItems[2].getObject()).getParameterList().getParametersCount());
|
||||
}
|
||||
|
||||
public void testStatsForClassNameInExpression() throws Throwable {
|
||||
final VirtualFile foo = getSourceRoot().createChildDirectory(this, "foo");
|
||||
VfsUtil.saveText(foo.createChildData(this, "FooBar.java"), "package foo; public interface FooBar {}");
|
||||
VfsUtil.saveText(foo.createChildData(this, "FooBee.java"), "package foo; public interface FooBee {}");
|
||||
|
||||
checkPreferredItems(0, "FooBar", "FooBee");
|
||||
incUseCount(getLookup(), 1);
|
||||
assertPreferredItems(0, "FooBee", "FooBar");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user