mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-09 20:42:52 +07:00
expected type should always be at the top of the lookup in smart completion after new
This commit is contained in:
@@ -55,7 +55,9 @@ public class JavaCompletionSorting {
|
||||
final boolean afterNew = JavaSmartCompletionContributor.AFTER_NEW.accepts(position);
|
||||
|
||||
List<LookupElementWeigher> afterNegativeStats = new ArrayList<LookupElementWeigher>();
|
||||
ContainerUtil.addIfNotNull(afterNegativeStats, smart ? new PreferDefaultTypeWeigher(expectedTypes, parameters) : preferStatics(position));
|
||||
if (!smart) {
|
||||
ContainerUtil.addIfNotNull(afterNegativeStats, preferStatics(position));
|
||||
}
|
||||
afterNegativeStats.add(new PreferLocalVariablesLiteralsAndAnnoMethodsWeigher(type, position));
|
||||
ContainerUtil.addIfNotNull(afterNegativeStats, recursion(parameters, expectedTypes));
|
||||
if (!smart && !afterNew) {
|
||||
@@ -74,6 +76,9 @@ public class JavaCompletionSorting {
|
||||
if (!smart && afterNew) {
|
||||
sorter = sorter.weighBefore("liftShorter", new PreferExpected(true, expectedTypes));
|
||||
}
|
||||
if (smart) {
|
||||
sorter = sorter.weighBefore("negativeStats", new PreferDefaultTypeWeigher(expectedTypes, parameters));
|
||||
}
|
||||
sorter = sorter.weighAfter("negativeStats", afterNegativeStats.toArray(new LookupElementWeigher[afterNegativeStats.size()]));
|
||||
sorter = sorter.weighAfter("prefix", new PreferNonGeneric(), new PreferAccessible(position), new PreferSimple(), new PreferEnumConstants(parameters));
|
||||
sorter = sorter.weighAfter("proximity", afterProximity.toArray(new LookupElementWeigher[afterProximity.size()]));
|
||||
|
||||
Reference in New Issue
Block a user