KT-12369 Completion: pressing dot after class name should not cause insertion of constructor call
#KT-12369 Fixed
This commit is contained in:
@@ -180,6 +180,7 @@ object PreferMatchingItemWeigher : LookupElementWeigher("kotlin.preferMatching",
|
|||||||
keywordExactMatch,
|
keywordExactMatch,
|
||||||
defaultExactMatch,
|
defaultExactMatch,
|
||||||
functionExactMatch,
|
functionExactMatch,
|
||||||
|
specialExactMatch,
|
||||||
notExactMatch
|
notExactMatch
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,7 +193,16 @@ object PreferMatchingItemWeigher : LookupElementWeigher("kotlin.preferMatching",
|
|||||||
val o = element.`object`
|
val o = element.`object`
|
||||||
return when (o) {
|
return when (o) {
|
||||||
is KeywordLookupObject -> Weight.keywordExactMatch
|
is KeywordLookupObject -> Weight.keywordExactMatch
|
||||||
is DeclarationLookupObject -> if (o.descriptor is FunctionDescriptor) Weight.functionExactMatch else Weight.defaultExactMatch
|
|
||||||
|
is DeclarationLookupObject -> {
|
||||||
|
val smartCompletionPriority = element.getUserData(SMART_COMPLETION_ITEM_PRIORITY_KEY)
|
||||||
|
when {
|
||||||
|
smartCompletionPriority != null && smartCompletionPriority != SmartCompletionItemPriority.DEFAULT -> Weight.specialExactMatch
|
||||||
|
o.descriptor is FunctionDescriptor -> Weight.functionExactMatch
|
||||||
|
else -> Weight.defaultExactMatch
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else -> Weight.defaultExactMatch
|
else -> Weight.defaultExactMatch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
class Color {
|
||||||
|
companion object {
|
||||||
|
val RED = Color()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getColor(): Color? {
|
||||||
|
return Color<caret>
|
||||||
|
}
|
||||||
|
|
||||||
|
// INVOCATION_COUNT: 0
|
||||||
|
// ELEMENT: *
|
||||||
|
// CHAR: '.'
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
class Color {
|
||||||
|
companion object {
|
||||||
|
val RED = Color()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getColor(): Color? {
|
||||||
|
return Color.<caret>
|
||||||
|
}
|
||||||
|
|
||||||
|
// INVOCATION_COUNT: 0
|
||||||
|
// ELEMENT: *
|
||||||
|
// CHAR: '.'
|
||||||
+6
@@ -155,6 +155,12 @@ public class BasicCompletionHandlerTestGenerated extends AbstractBasicCompletion
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("PreferClassToConstructor.kt")
|
||||||
|
public void testPreferClassToConstructor() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/handlers/basic/PreferClassToConstructor.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("PreferMatchingKeyword.kt")
|
@TestMetadata("PreferMatchingKeyword.kt")
|
||||||
public void testPreferMatchingKeyword() throws Exception {
|
public void testPreferMatchingKeyword() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/handlers/basic/PreferMatchingKeyword.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/handlers/basic/PreferMatchingKeyword.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user