diff --git a/plugins/kotlin/idea/tests/testData/intentions/introduceVariable/afterExpression.kt.after.k2 b/plugins/kotlin/idea/tests/testData/intentions/introduceVariable/afterExpression.kt.after.k2 deleted file mode 100644 index 1a7fe2032655..000000000000 --- a/plugins/kotlin/idea/tests/testData/intentions/introduceVariable/afterExpression.kt.after.k2 +++ /dev/null @@ -1,6 +0,0 @@ -fun foo(a: Int, b: Int) = a + b - -fun foo() { - val foo = foo(1 + 2, 3 * 4) // -// AFTER-WARNING: Variable 'foo' is never used -} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/intentions/introduceVariable/atExpressionEnd.kt.after.k2 b/plugins/kotlin/idea/tests/testData/intentions/introduceVariable/atExpressionEnd.kt.after.k2 deleted file mode 100644 index 4c9ffa388d2b..000000000000 --- a/plugins/kotlin/idea/tests/testData/intentions/introduceVariable/atExpressionEnd.kt.after.k2 +++ /dev/null @@ -1,6 +0,0 @@ -// AFTER-WARNING: Variable 'foo' is never used -fun foo(a: Int, b: Int) = a + b - -fun foo() { - val foo = foo(1 + 2, 3 * 4) -} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/intentions/introduceVariable/atExpressionStart.kt.after.k2 b/plugins/kotlin/idea/tests/testData/intentions/introduceVariable/atExpressionStart.kt.after.k2 deleted file mode 100644 index 4c9ffa388d2b..000000000000 --- a/plugins/kotlin/idea/tests/testData/intentions/introduceVariable/atExpressionStart.kt.after.k2 +++ /dev/null @@ -1,6 +0,0 @@ -// AFTER-WARNING: Variable 'foo' is never used -fun foo(a: Int, b: Int) = a + b - -fun foo() { - val foo = foo(1 + 2, 3 * 4) -} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/intentions/introduceVariable/atNestedExpression.kt.after.k2 b/plugins/kotlin/idea/tests/testData/intentions/introduceVariable/atNestedExpression.kt.after.k2 deleted file mode 100644 index 4c9ffa388d2b..000000000000 --- a/plugins/kotlin/idea/tests/testData/intentions/introduceVariable/atNestedExpression.kt.after.k2 +++ /dev/null @@ -1,6 +0,0 @@ -// AFTER-WARNING: Variable 'foo' is never used -fun foo(a: Int, b: Int) = a + b - -fun foo() { - val foo = foo(1 + 2, 3 * 4) -} \ No newline at end of file diff --git a/plugins/kotlin/refactorings/kotlin.refactorings.k2/src/org/jetbrains/kotlin/idea/k2/refactoring/introduce/introduceVariable/K2IntroduceVariableHandler.kt b/plugins/kotlin/refactorings/kotlin.refactorings.k2/src/org/jetbrains/kotlin/idea/k2/refactoring/introduce/introduceVariable/K2IntroduceVariableHandler.kt index 972cef4752bd..facf588acf64 100644 --- a/plugins/kotlin/refactorings/kotlin.refactorings.k2/src/org/jetbrains/kotlin/idea/k2/refactoring/introduce/introduceVariable/K2IntroduceVariableHandler.kt +++ b/plugins/kotlin/refactorings/kotlin.refactorings.k2/src/org/jetbrains/kotlin/idea/k2/refactoring/introduce/introduceVariable/K2IntroduceVariableHandler.kt @@ -219,7 +219,7 @@ object K2IntroduceVariableHandler : KotlinIntroduceVariableHandler() { } } - val isInplaceAvailable = editor != null + val isInplaceAvailable = isInplaceAvailable(editor, project) val allOccurrences = occurrencesToReplace ?: expression.findOccurrences(containers.occurrenceContainer)