KT-5292 Expand selection should have kdoc + method as a stop point

KT-3947 Extend selection works badly with comment

 #KT-5292 Fixed
 #KT-3947 Fixed
This commit is contained in:
Valentin Kipyatkov
2014-12-07 21:07:26 -07:00
parent acdb750c91
commit 46906fd89c
36 changed files with 327 additions and 29 deletions
@@ -0,0 +1,9 @@
package p
/**
* Doc comment <caret>here
*/
fun foo() {
}
fun bar(){}
@@ -0,0 +1,9 @@
package p
/**
* Doc comment <selection><caret>here</selection>
*/
fun foo() {
}
fun bar(){}
@@ -0,0 +1,9 @@
package p
/**
*<selection> Doc comment <caret>here</selection>
*/
fun foo() {
}
fun bar(){}
@@ -0,0 +1,9 @@
package p
<selection>/**
* Doc comment <caret>here
*/
</selection>fun foo() {
}
fun bar(){}
@@ -0,0 +1,9 @@
package p
<selection>/**
* Doc comment <caret>here
*/
fun foo() {
}
</selection>
fun bar(){}
@@ -0,0 +1,5 @@
fun a() : <caret>Int {} // fun a
fun b() : Short {
f()
}
@@ -0,0 +1,5 @@
fun a() : <selection><caret>Int</selection> {} // fun a
fun b() : Short {
f()
}
@@ -0,0 +1,5 @@
<selection>fun a() : <caret>Int {}</selection> // fun a
fun b() : Short {
f()
}
@@ -0,0 +1,5 @@
<selection>fun a() : <caret>Int {} // fun a</selection>
fun b() : Short {
f()
}
@@ -0,0 +1,5 @@
<selection>fun a() : <caret>Int {} // fun a
</selection>
fun b() : Short {
f()
}
@@ -0,0 +1,6 @@
fun a() : Int {}
// TODO: Refactor
fun b() : <caret>Short {
f()
}
@@ -0,0 +1,6 @@
fun a() : Int {}
// TODO: Refactor
fun b() : <selection><caret>Short</selection> {
f()
}
@@ -0,0 +1,7 @@
fun a() : Int {}
// TODO: Refactor
<selection>fun b() : <caret>Short {
f()
}
</selection>
@@ -0,0 +1,7 @@
fun a() : Int {}
<selection>// TODO: Refactor
fun b() : <caret>Short {
f()
}
</selection>
@@ -0,0 +1,8 @@
package p
class C{
// This is a <caret>val
val v = 1
fun foo(){}
}
@@ -0,0 +1,8 @@
package p
class C{
// This is a <selection><caret>val</selection>
val v = 1
fun foo(){}
}
@@ -0,0 +1,8 @@
package p
class C{
// <selection>This is a <caret>val</selection>
val v = 1
fun foo(){}
}
@@ -0,0 +1,8 @@
package p
class C{
<selection>// This is a <caret>val</selection>
val v = 1
fun foo(){}
}
@@ -0,0 +1,8 @@
package p
class C{
<selection> // This is a <caret>val
</selection> val v = 1
fun foo(){}
}
@@ -0,0 +1,8 @@
package p
class C{
<selection> // This is a <caret>val
val v = 1
</selection>
fun foo(){}
}
@@ -0,0 +1,7 @@
package p
/* This is a <caret>comment */
fun foo() {
}
fun bar(){}
@@ -0,0 +1,7 @@
package p
/* This is a <selection><caret>comment</selection> */
fun foo() {
}
fun bar(){}
@@ -0,0 +1,7 @@
package p
<selection>/* This is a <caret>comment */</selection>
fun foo() {
}
fun bar(){}
@@ -0,0 +1,7 @@
package p
<selection>/* This is a <caret>comment */
</selection>fun foo() {
}
fun bar(){}
@@ -0,0 +1,7 @@
package p
<selection>/* This is a <caret>comment */
fun foo() {
}
</selection>
fun bar(){}
+1 -1
View File
@@ -10,7 +10,7 @@ fun main(args : Array<String>) {
}
}
<selection>fun foo() : Unit {
fun foo() : Unit <selection>{
println() {
println()
+2 -2
View File
@@ -1,4 +1,4 @@
<selection>fun main(args : Array<String>) {
fun main(args : Array<String>) {
for (i in 1..100) {
when {
i%3 == 0 -> {print("Fizz"); continue;}
@@ -10,7 +10,7 @@
}
}
fun foo() : Unit {
<selection>fun foo() : Unit {
println() {
println()
@@ -0,0 +1,24 @@
<selection>fun main(args : Array<String>) {
for (i in 1..100) {
when {
i%3 == 0 -> {print("Fizz"); continue;}
i%5 == 0 -> {print("Buzz"); continue;}
(i%3 != 0 && i%5 != 0) -> {print(i); continue;}
else -> println()
}
}
}
fun foo() : Unit {
println() {
println()
pr<caret>intln()
println()
}
println(array(1, 2, 3))
println()
}</selection>
+2 -2
View File
@@ -17,8 +17,8 @@ fun foo() : Unit {
pr<caret>intln()
println()
}
</selection>
}</selection>
println(array(1, 2, 3))
println()
}
+1 -1
View File
@@ -11,7 +11,7 @@ fun main(args : Array<String>) {
}
fun foo() : Unit {
<selection> println() {
println() <selection>{
println()
+2 -2
View File
@@ -18,7 +18,7 @@ fun foo() : Unit {
pr<caret>intln()
println()
}
</selection>
println(array(1, 2, 3))
println()
</selection>}
}
+3 -3
View File
@@ -10,8 +10,8 @@ fun main(args : Array<String>) {
}
}
fun foo() : Unit <selection>{
println() {
fun foo() : Unit {
<selection> println() {
println()
@@ -21,4 +21,4 @@ fun foo() : Unit <selection>{
println(array(1, 2, 3))
println()
}</selection>
</selection>}