ReplaceItWithExplicitFunctionLiteralParamIntention - better caret position

This commit is contained in:
Valentin Kipyatkov
2015-04-28 21:59:07 +03:00
parent 01a8ff0860
commit 1daf12cf70
4 changed files with 4 additions and 4 deletions
@@ -55,7 +55,7 @@ public class ReplaceItWithExplicitFunctionLiteralParamIntention() : JetSelfTarge
PsiDocumentManager.getInstance(element.getProject()).doPostponedOperationsAndUnblockDocument(editor.getDocument())
val paramToRename = functionLiteral.getValueParameters().single()
editor.getCaretModel().moveToOffset(paramToRename.getTextOffset())
editor.getCaretModel().moveToOffset(element.getTextOffset())
VariableInplaceRenameHandler().doRename(paramToRename, editor, null)
}
}
@@ -1,2 +1,2 @@
fun applyTwice<A>(f: (A) -> A, x: A) = f(f(x))
val x = applyTwice({ <caret>it -> it + 1 }, 40)
val x = applyTwice({ it -> <caret>it + 1 }, 40)
@@ -1,2 +1,2 @@
fun foo(i: (Int) -> Int) = 0
val x = foo { <caret>it -> foo { x -> x + it } }
val x = foo { it -> foo { x -> x + <caret>it } }
@@ -1,2 +1,2 @@
fun foo(a: (Int) -> Int): Int = a(1)
val x = foo { it + foo { <caret>it -> it } }
val x = foo { it + foo { it -> <caret>it } }