Add Initializer Quick-Fix: Place caret at the end of generated initializer
#KT-10704 Fixed
This commit is contained in:
@@ -61,6 +61,7 @@ object InitializePropertyQuickFixFactory : KotlinIntentionActionsFactory() {
|
|||||||
if (editor != null) {
|
if (editor != null) {
|
||||||
PsiDocumentManager.getInstance(project).commitDocument(editor.document)
|
PsiDocumentManager.getInstance(project).commitDocument(editor.document)
|
||||||
editor.selectionModel.setSelection(initializer.startOffset, initializer.endOffset)
|
editor.selectionModel.setSelection(initializer.startOffset, initializer.endOffset)
|
||||||
|
editor.caretModel.moveToOffset(initializer.endOffset)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Add initializer" "true"
|
// "Add initializer" "true"
|
||||||
class A {
|
class A {
|
||||||
<caret>val n: Int = <selection>0</selection>
|
val n: Int = <selection>0</selection><caret>
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
// "Add initializer" "true"
|
// "Add initializer" "true"
|
||||||
class A {
|
class A {
|
||||||
var n: Int = <selection>0</selection>
|
var n: Int = <selection>0</selection><caret>
|
||||||
get() = 1
|
get() = 1
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
// "Add initializer" "true"
|
// "Add initializer" "true"
|
||||||
class A {
|
class A {
|
||||||
var n: Int = <selection>0</selection>
|
var n: Int = <selection>0</selection><caret>
|
||||||
set(value: Int) {}
|
set(value: Int) {}
|
||||||
}
|
}
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
// "Add initializer" "true"
|
// "Add initializer" "true"
|
||||||
<caret>val n: Int = <selection>0</selection>
|
val n: Int = <selection>0</selection><caret>
|
||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
// "Add initializer" "true"
|
// "Add initializer" "true"
|
||||||
<caret>var n: Int = <selection>0</selection>
|
var n: Int = <selection>0</selection><caret>
|
||||||
get() = 1
|
get() = 1
|
||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
// "Add initializer" "true"
|
// "Add initializer" "true"
|
||||||
<caret>var n: Int = <selection>0</selection>
|
var n: Int = <selection>0</selection><caret>
|
||||||
set(value: Int) {}
|
set(value: Int) {}
|
||||||
Reference in New Issue
Block a user