From 1daf12cf70f222a093d6b3ac6d0e78cee86f7186 Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Tue, 28 Apr 2015 21:59:07 +0300 Subject: [PATCH] ReplaceItWithExplicitFunctionLiteralParamIntention - better caret position --- .../ReplaceItWithExplicitFunctionLiteralParamIntention.kt | 2 +- .../applicable.kt.after | 2 +- .../applicable_nestedFunctionLiterals.kt.after | 2 +- .../applicable_nestedFunctionWithIt.kt.after | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceItWithExplicitFunctionLiteralParamIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceItWithExplicitFunctionLiteralParamIntention.kt index 2341093c3d1..6fdcc82b4e7 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceItWithExplicitFunctionLiteralParamIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceItWithExplicitFunctionLiteralParamIntention.kt @@ -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) } } diff --git a/idea/testData/intentions/replaceItWithExplicitFunctionLiteralParam/applicable.kt.after b/idea/testData/intentions/replaceItWithExplicitFunctionLiteralParam/applicable.kt.after index 32c9ecc013c..502116cd9df 100644 --- a/idea/testData/intentions/replaceItWithExplicitFunctionLiteralParam/applicable.kt.after +++ b/idea/testData/intentions/replaceItWithExplicitFunctionLiteralParam/applicable.kt.after @@ -1,2 +1,2 @@ fun applyTwice(f: (A) -> A, x: A) = f(f(x)) -val x = applyTwice({ it -> it + 1 }, 40) +val x = applyTwice({ it -> it + 1 }, 40) diff --git a/idea/testData/intentions/replaceItWithExplicitFunctionLiteralParam/applicable_nestedFunctionLiterals.kt.after b/idea/testData/intentions/replaceItWithExplicitFunctionLiteralParam/applicable_nestedFunctionLiterals.kt.after index 42ec3d827d6..2c72af5a7c5 100644 --- a/idea/testData/intentions/replaceItWithExplicitFunctionLiteralParam/applicable_nestedFunctionLiterals.kt.after +++ b/idea/testData/intentions/replaceItWithExplicitFunctionLiteralParam/applicable_nestedFunctionLiterals.kt.after @@ -1,2 +1,2 @@ fun foo(i: (Int) -> Int) = 0 -val x = foo { it -> foo { x -> x + it } } +val x = foo { it -> foo { x -> x + it } } diff --git a/idea/testData/intentions/replaceItWithExplicitFunctionLiteralParam/applicable_nestedFunctionWithIt.kt.after b/idea/testData/intentions/replaceItWithExplicitFunctionLiteralParam/applicable_nestedFunctionWithIt.kt.after index 3a530fc4654..f9a6f401e92 100644 --- a/idea/testData/intentions/replaceItWithExplicitFunctionLiteralParam/applicable_nestedFunctionWithIt.kt.after +++ b/idea/testData/intentions/replaceItWithExplicitFunctionLiteralParam/applicable_nestedFunctionWithIt.kt.after @@ -1,2 +1,2 @@ fun foo(a: (Int) -> Int): Int = a(1) -val x = foo { it + foo { it -> it } } \ No newline at end of file +val x = foo { it + foo { it -> it } } \ No newline at end of file