KT-13728 Implicitly imported functions should be above in completion then non-imported

#KT-13728 Fixed
This commit is contained in:
Valentin Kipyatkov
2016-09-27 21:13:13 +03:00
parent e8f4c65455
commit 7263d0a056
5 changed files with 19 additions and 0 deletions
@@ -230,6 +230,7 @@ object PreferMatchingItemWeigher : LookupElementWeigher("kotlin.preferMatching",
keywordExactMatch,
defaultExactMatch,
functionExactMatch,
notImportedExactMatch,
specialExactMatch,
notExactMatch
}
@@ -248,6 +249,7 @@ object PreferMatchingItemWeigher : LookupElementWeigher("kotlin.preferMatching",
val smartCompletionPriority = element.getUserData(SMART_COMPLETION_ITEM_PRIORITY_KEY)
when {
smartCompletionPriority != null && smartCompletionPriority != SmartCompletionItemPriority.DEFAULT -> Weight.specialExactMatch
element.getUserData(NOT_IMPORTED_KEY) != null -> Weight.notImportedExactMatch
o.descriptor is FunctionDescriptor -> Weight.functionExactMatch
else -> Weight.defaultExactMatch
}
@@ -0,0 +1,3 @@
package other
class TODO
@@ -0,0 +1,3 @@
package kotlin
public inline fun TODO(): Nothing = throw NotImplementedError()
@@ -0,0 +1,5 @@
fun foo(): Any? = TODO<caret>
// WITH_ORDER
// EXIST: { itemText: "TODO", tailText:"() (kotlin)" }
// EXIST: { itemText: "TODO", tailText:" (other)" }
@@ -95,6 +95,12 @@ public class MultiFileJvmBasicCompletionTestGenerated extends AbstractMultiFileJ
doTest(fileName);
}
@TestMetadata("ExactMatchPreferImported")
public void testExactMatchPreferImported() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/multifile/ExactMatchPreferImported/");
doTest(fileName);
}
@TestMetadata("ExcludedClass")
public void testExcludedClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/multifile/ExcludedClass/");