Create expect/actual should move cursor to target declaration

#KT-34411 Fixed
This commit is contained in:
Dmitry Gridin
2019-10-31 16:09:27 +07:00
parent 8e2943ae2a
commit 17429d333e
3 changed files with 4 additions and 3 deletions
@@ -89,7 +89,8 @@ abstract class AbstractCreateDeclarationFix<D : KtNamedDeclaration>(
val reformatted = CodeStyleManager.getInstance(project).reformat(generatedDeclaration)
val shortened = ShortenReferences.DEFAULT.process(reformatted as KtElement)
EditorHelper.openInEditor(shortened)?.caretModel?.moveToOffset(
(shortened as? KtNamedDeclaration)?.nameIdentifier?.startOffset ?: shortened.startOffset
(shortened as? KtNamedDeclaration)?.nameIdentifier?.startOffset ?: shortened.startOffset,
true
)
}
}
@@ -1,5 +1,5 @@
// Abstract: to be implemented
actual abstract class Abstract {
actual abstract class <caret>Abstract {
actual fun foo(param: String): Int {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -1 +1 @@
expect fun foo(i: Int, d: Double, s: String): Boolean
expect fun <caret>foo(i: Int, d: Double, s: String): Boolean