Smart completion: prefer items matching by name

This commit is contained in:
Valentin Kipyatkov
2014-09-23 23:01:57 +04:00
committed by valentin
parent 56978c4e16
commit 0462d152eb
38 changed files with 414 additions and 48 deletions
@@ -0,0 +1,9 @@
fun foo1() {}
deprecated("Use foo3 instead") fun foo2() {}
fun foo3() {}
fun test() {
foo<caret>
}
// ORDER: foo1, foo3, foo2
@@ -0,0 +1,11 @@
fun test() {
val ifMore = true
val isFirst = true
if<caret>
}
// ORDER: if
// ORDER: ifMore
// ORDER: isFirst
// ORDER: ifn
// SELECTED: 0
@@ -0,0 +1,6 @@
fun main(variables: Array<String>) {
val values = ""
va<caret>
}
// ORDER: values, val, variables, var, vararg
@@ -0,0 +1,5 @@
package some
fun foo() = 12
fun fooImported() = 12
fun fooNotImported() = 12
@@ -0,0 +1,12 @@
import some.fooImported
val fooVar = 12
fun fooLocal() = 12
val some = foo<caret>
// "foo" is before other elements because of exact prefix match
// ORDER: foo, fooVar, fooLocal, fooImported, fooNotImported
// INVOCATION_COUNT: 2
// SELECTED: 0
@@ -0,0 +1,8 @@
val initGlobal = 12
fun test(initParam : Int) {
val initLocal = "Test"
init<caret>
}
// ORDER: initLocal, initParam, initGlobal
@@ -0,0 +1,6 @@
fun test() {
val a = 12
a<caret>
}
// ORDER: a, as
@@ -0,0 +1,6 @@
fun test(fals: Int) {
val falt = 111
fa<caret>
}
// ORDER: fals, falt, false
@@ -0,0 +1,10 @@
package temp.test
class Options(val listNew: Boolean, val listMatch: Boolean) {
}
fun listImportedFun() = 12
val listImportedVal = 11
@@ -0,0 +1,22 @@
package test
import temp.test.*
val listThisFileVal = 12
fun listThisFileFun() = 1
class ListThisFileClass {}
fun test(listParam: Int) {
val listLocalVal = 12
Options(list<caret>)
}
// ORDER: listLocalVal
// ORDER: listParam
// ORDER: listThisFileVal
// ORDER: listImportedVal
// ORDER: listThisFileFun
// ORDER: listImportedFun
// ORDER: "listMatch ="
// ORDER: "listNew ="
@@ -0,0 +1,5 @@
fun bar(fop: Int) {
fo<caret>
}
// ORDER: fop, for
@@ -0,0 +1,19 @@
val br1 = 11
fun br() = 111
class Test(val br2 = 12) {
val br3 = 13
fun brf() = 112
fun test(br4: Int) {
val br5 = 14
br<caret>
}
}
// "br" function is before other elements because of exact prefix match
// ORDER: br, br4, br5, br1, br2, br3, break, brf
// SELECTED: 0