mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-06 06:21:16 +07:00
prefer the expected type even if it's inner
This commit is contained in:
+5
-5
@@ -20,7 +20,6 @@ import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
@@ -34,11 +33,12 @@ public class PreferExpectedTypeWeigher extends CompletionWeigher {
|
||||
}
|
||||
|
||||
public MyResult weigh(@NotNull final LookupElement item, @NotNull final CompletionLocation location) {
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
if (location.getCompletionType() != CompletionType.BASIC) return MyResult.normal;
|
||||
if (item.getObject() instanceof PsiClass) return MyResult.normal;
|
||||
if (item.getObject() instanceof PsiClass) {
|
||||
if (!JavaSmartCompletionContributor.AFTER_NEW.accepts(location.getCompletionParameters().getPosition())) {
|
||||
return MyResult.normal;
|
||||
}
|
||||
}
|
||||
|
||||
ExpectedTypeInfo[] expectedInfos = JavaCompletionUtil.EXPECTED_TYPES.getValue(location);
|
||||
if (expectedInfos == null) return MyResult.normal;
|
||||
|
||||
Reference in New Issue
Block a user