ReplaceItWithExplicitFunctionLiteralParamIntention - better caret position
This commit is contained in:
+1
-1
@@ -55,7 +55,7 @@ public class ReplaceItWithExplicitFunctionLiteralParamIntention() : JetSelfTarge
|
|||||||
PsiDocumentManager.getInstance(element.getProject()).doPostponedOperationsAndUnblockDocument(editor.getDocument())
|
PsiDocumentManager.getInstance(element.getProject()).doPostponedOperationsAndUnblockDocument(editor.getDocument())
|
||||||
|
|
||||||
val paramToRename = functionLiteral.getValueParameters().single()
|
val paramToRename = functionLiteral.getValueParameters().single()
|
||||||
editor.getCaretModel().moveToOffset(paramToRename.getTextOffset())
|
editor.getCaretModel().moveToOffset(element.getTextOffset())
|
||||||
VariableInplaceRenameHandler().doRename(paramToRename, editor, null)
|
VariableInplaceRenameHandler().doRename(paramToRename, editor, null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
fun applyTwice<A>(f: (A) -> A, x: A) = f(f(x))
|
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
-1
@@ -1,2 +1,2 @@
|
|||||||
fun foo(i: (Int) -> Int) = 0
|
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
-1
@@ -1,2 +1,2 @@
|
|||||||
fun foo(a: (Int) -> Int): Int = a(1)
|
fun foo(a: (Int) -> Int): Int = a(1)
|
||||||
val x = foo { it + foo { <caret>it -> it } }
|
val x = foo { it + foo { it -> <caret>it } }
|
||||||
Reference in New Issue
Block a user