Show Review Added Imports on paste action

Fixed multi-caret selection in kotlin-to-kotlin copy-paste processor

Relates to #KT-33939
This commit is contained in:
Vladimir Dolzhenko
2020-01-20 21:39:12 +01:00
parent 84fd5b35eb
commit db8b0a6593
19 changed files with 463 additions and 48 deletions
@@ -0,0 +1,20 @@
// ERROR: Unresolved reference: B
// ERROR: Unresolved reference: B
// ERROR: Unresolved reference: B
// ERROR: A 'return' expression required in a function with a block body ('{...}')
package to
import a.A
import a.T
import java.util.*
import java.util.concurrent.atomic.AtomicReference
import java.util.concurrent.atomic.AtomicLong as ALong
fun g(t: T): Int {
g(A)
B.f()
A
B
A.Companion
B.Companion
}
@@ -0,0 +1,3 @@
a.A
a.B
a.T
@@ -0,0 +1 @@
a.B
@@ -0,0 +1,25 @@
package a
interface T
class A {
companion object: T {
}
}
class B {
companion object {
fun f(): Int
}
}
<selection>fun g(t: T): Int {
g(A)
B.f()
A
B
A.Companion
B.Companion
}</selection>
@@ -0,0 +1,7 @@
package to
import java.util.*
import java.util.concurrent.atomic.AtomicReference
import java.util.concurrent.atomic.AtomicLong as ALong
<caret>
+1 -1
View File
@@ -14,7 +14,7 @@ package d
import foo.Bar
/**
* Some kdoc for class Foo
* Some kdoc [Bar] for class Foo
*/
class Foo(val a: A) {
}
+1 -1
View File
@@ -12,7 +12,7 @@ package d
import foo.Bar
/**
* Some kdoc for class Foo
* Some kdoc [Bar] for class Foo
*/
class Foo(val a: A) {
}
@@ -0,0 +1,3 @@
package foo
class Bar(val v: Int){}
@@ -0,0 +1,19 @@
package to
import d.A
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package d
import foo.Bar
/**
* Some kdoc [Bar] for class Foo
*/
class Foo(val a: A) {
}
@@ -0,0 +1 @@
d.A
@@ -0,0 +1,22 @@
// WITH_LIBRARY: copyPaste/imports/KotlinLibrary
<selection>
<caret>/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package d</selection>
/*
* Some comment in front of imports
*/
<selection>
<caret>import foo.Bar</selection>
<selection>
<caret>/**
* Some kdoc [Bar] for class Foo
*/</selection>
<selection>
<caret>class Foo(val a: A) {
}
</selection>