Completion of lambda parameters

Also changed policy for sorting of smart completion items in basic completion

 #KT-16800 Fixed
 #KT-12002 Fixed
This commit is contained in:
Valentin Kipyatkov
2017-03-16 20:36:08 +03:00
parent c6b9aebfcf
commit b5dd2cc540
66 changed files with 558 additions and 256 deletions
@@ -3,4 +3,4 @@ fun small(param: Int) {
fun test() = small(<caret>)
// EXIST: {"lookupString":"param","tailText":" Int","itemText":"param ="}
// EXIST: {"lookupString":"param =","tailText":" Int","itemText":"param ="}
@@ -4,4 +4,4 @@ fun small(first: Int, second: Int) {
fun test() = small(12, <caret>)
// ABSENT: first
// EXIST: { lookupString:"second", itemText:"second =" }
// EXIST: { lookupString:"second =", itemText:"second =" }
@@ -4,4 +4,4 @@ fun bar(s: String){
foo("", "", <caret>)
}
// EXIST: { lookupString:"option", itemText:"option =" }
// EXIST: { lookupString:"option =", itemText:"option =" }
@@ -5,5 +5,5 @@ fun small(paramFirst: Sequence<String>, paramSecond: Comparable<kotlin.collectio
fun test() = small(<caret>)
// EXIST: {"lookupString":"paramSecond","tailText":" Comparable<List<Any>>","itemText":"paramSecond ="}
// EXIST: {"lookupString":"paramFirst","tailText":" Sequence<String>","itemText":"paramFirst ="}
// EXIST: {"lookupString":"paramSecond =","tailText":" Comparable<List<Any>>","itemText":"paramSecond ="}
// EXIST: {"lookupString":"paramFirst =","tailText":" Sequence<String>","itemText":"paramFirst ="}
@@ -6,6 +6,6 @@ fun small(paramFirst: Int, paramSecond: Int) {
fun test() = small(paramFirst = param<caret>)
// EXIST: paramTest
// ABSENT: {"lookupString":"paramFirst","tailText":" Int","itemText":"paramFirst ="}
// ABSENT: paramSecond
// ABSENT: { itemText: "paramFirst =" }
// ABSENT: { itemText: "paramSecond =" }
// NOTHING_ELSE
@@ -11,7 +11,7 @@ fun other() {
}
// EXIST: nLocal
// EXIST: { lookupString:"nFirst", itemText:"nFirst =", tailText: " String" }
// EXIST: { lookupString:"nFirst =", itemText:"nFirst =", tailText: " String" }
// EXIST: { itemText: "nClassParam =", tailText: " String" }
// EXIST: { itemText: "nClassField =", tailText: " String" }
// EXIST: { itemText: "nSecond =", tailText: " String?" }
@@ -4,8 +4,8 @@ fun test() {
foo("str", paramThird = "test", param<caret>)
}
// ABSENT: paramFirst
// EXIST: paramSecond
// ABSENT: paramThird
// EXIST: paramFourth
// ABSENT: "paramFirst ="
// EXIST: "paramSecond ="
// ABSENT: "paramThird ="
// EXIST: "paramFourth ="
@@ -5,7 +5,7 @@ fun test() {
foo(12, param<caret>)
}
// ABSENT: paramFirst
// EXIST: {"lookupString":"paramSecond","tailText":" Int","itemText":"paramSecond ="}
// ABSENT: paramThird
// ABSENT: paramFourth
// ABSENT: "paramFirst ="
// EXIST: {"lookupString":"paramSecond =","tailText":" Int","itemText":"paramSecond ="}
// ABSENT: "paramThird ="
// ABSENT: "paramFourth ="
@@ -4,6 +4,6 @@ fun foo(first: Int, second: Int, third: String) {
fun test(p: Int) = foo(12, <caret>, third = "")
// EXIST: p
// ABSENT: first
// EXIST: third
// EXIST: second
// ABSENT: "first ="
// EXIST: "third ="
// EXIST: "second ="
@@ -4,6 +4,6 @@ fun foo(first: Int, second: Int, third: String) {
fun test(p: Int) = foo(<caret>second = 3)
// EXIST: p
// EXIST: first
// EXIST: second
// EXIST: third
// EXIST: "first ="
// EXIST: "second ="
// EXIST: "third ="
@@ -6,5 +6,5 @@ fun other() {
Foo(p<caret>)
}
// EXIST: {"lookupString":"pFirst","tailText":" String?","itemText":"pFirst ="}
// EXIST: {"lookupString":"pSecond","tailText":" Int","itemText":"pSecond ="}
// EXIST: {"lookupString":"pFirst =","tailText":" String?","itemText":"pFirst ="}
// EXIST: {"lookupString":"pSecond =","tailText":" Int","itemText":"pSecond ="}
@@ -4,7 +4,7 @@ fun foo(first: Int, second: Int, third: String) {
fun test(p: Int) = foo(12, third = "", <caret>)
// ABSENT: p
// ABSENT: first
// ABSENT: third
// EXIST: second
// ABSENT: "first ="
// ABSENT: "third ="
// EXIST: "second ="
// NOTHING_ELSE
@@ -5,8 +5,8 @@ fun small(paramFirst: Int, paramSecond: Int) {
fun test() = small(param<caret>First = 12)
// EXIST: paramFirst
// EXIST: paramSecond
// EXIST: "paramFirst ="
// EXIST: "paramSecond ="
// EXIST: paramTest
// NOTHING_ELSE
@@ -3,4 +3,4 @@ import lib.KotlinClass
fun test() = KotlinClass().foo(<caret>)
// ABSENT: p0
// EXIST: { lookupString:"paramName", itemText:"paramName =" }
// EXIST: { lookupString:"paramName =", itemText:"paramName =" }