Optimization to reuse BindingContext in completion

This commit is contained in:
Valentin Kipyatkov
2016-10-31 22:49:37 +03:00
parent 1174c7bdd9
commit 09dbb07fb8
30 changed files with 548 additions and 22 deletions
@@ -0,0 +1,12 @@
fun foo(p1: Int, p2: String): Int {
val v1 = p2<change>
val v2 = 123
return <before><caret>
}
// TYPE: ".hashCode()"
// COMPLETION_TYPE: SMART
// EXIST: v1
// EXIST: v2
// EXIST: p1
// ABSENT: p2
@@ -0,0 +1,2 @@
No up-to-date data from previous completion
PSI-tree has changed inside current scope
@@ -0,0 +1,12 @@
fun foo(p: Int, p1: String): Int {
val v1 = p<change>
val v2 = 123
return <before><caret>
}
// TYPE: "1"
// COMPLETION_TYPE: SMART
// ABSENT: v1
// EXIST: v2
// EXIST: p
// ABSENT: p1
@@ -0,0 +1,2 @@
No up-to-date data from previous completion
PSI-tree has changed inside current scope
@@ -0,0 +1,8 @@
fun foo(p: Any): String {
if (p !is String) return ""
r<before><change>
}
// TYPE: "eturn "
// COMPLETION_TYPE: SMART
// EXIST: p
@@ -0,0 +1,3 @@
No up-to-date data from previous completion
Statement position is the same - analyzing only one statement:
return IntellijIdeaRulezzz
@@ -0,0 +1,10 @@
fun foo(p: Any): String {
println(1)
if (<before><change>
}
fun bar(s: String): Boolean = true
// TYPE: "p is String && bar("
// COMPLETION_TYPE: SMART
// EXIST: p
@@ -0,0 +1,4 @@
No up-to-date data from previous completion
Statement position is the same - analyzing only one statement:
if (p is String && bar(IntellijIdeaRulezzz$
@@ -0,0 +1,17 @@
fun foo(p1: Int, p2: String): String {
val v1 = p1.toString()
val v2 = 123
if (p1 > 0) {
print(1)
print(2)
}
else
r<before><change>
}
// TYPE: "eturn "
// COMPLETION_TYPE: SMART
// ABSENT: p1
// EXIST: p2
// EXIST: v1
// ABSENT: v2
@@ -0,0 +1,2 @@
No up-to-date data from previous completion
Current statement is too complex to use optimization
@@ -0,0 +1,10 @@
fun foo(p: String?): String {
println()
bar(p!!, <before><change>)
}
fun bar(s: String, p: Int) { }
// BACKSPACES: 4
// TYPE: "."
// EXIST: { itemText: "substring", attributes: "grayed" }
@@ -0,0 +1,3 @@
No up-to-date data from previous completion
Statement position is the same - analyzing only one statement:
bar(p.IntellijIdeaRulezzz$
@@ -0,0 +1,8 @@
fun foo(p1: Int, p2: String): String {
r<before><change>
}
// TYPE: "eturn "
// COMPLETION_TYPE: SMART
// ABSENT: p1
// EXIST: p2
@@ -0,0 +1,3 @@
No up-to-date data from previous completion
Statement position is the same - analyzing only one statement:
return IntellijIdeaRulezzz
@@ -0,0 +1,10 @@
fun foo(): Int {
println()
return <before><caret>
}
val xxx<change>
// TYPE: " = 1"
// COMPLETION_TYPE: SMART
// EXIST: xxx
@@ -0,0 +1,2 @@
No up-to-date data from previous completion
No up-to-date data from previous completion
@@ -0,0 +1,17 @@
fun foo(p1: Any, p2: Any) {
if (p1 !is String) return
val v1 = "a"
val v2 = 123
println("a")
bar(x<before><change>)
if (p2 !is String) return
}
fun bar(s: String){}
// BACKSPACES: 1
// COMPLETION_TYPE: SMART
// EXIST: v1
// ABSENT: v2
// EXIST: p1
// ABSENT: p2
@@ -0,0 +1,3 @@
No up-to-date data from previous completion
Statement position is the same - analyzing only one statement:
bar(IntellijIdeaRulezzz$
@@ -0,0 +1,12 @@
fun foo(p1: Int, p2: String): String {
val v1 = p1.toString()
val v2 = 123
r<before><change>
}
// TYPE: "eturn "
// COMPLETION_TYPE: SMART
// ABSENT: p1
// EXIST: p2
// EXIST: v1
// ABSENT: v2
@@ -0,0 +1,3 @@
No up-to-date data from previous completion
Statement position is the same - analyzing only one statement:
return IntellijIdeaRulezzz