diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveForLoopIndicesIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveForLoopIndicesIntention.kt index af0b5a4d853..eaff1961b28 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveForLoopIndicesIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveForLoopIndicesIntention.kt @@ -26,19 +26,7 @@ import org.jetbrains.kotlin.psi.JetPsiFactory import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.DescriptorUtils -public class RemoveForLoopIndicesIntention : JetSelfTargetingIntention( - javaClass(), "Remove indices in for-loop") { - override fun applyTo(element: JetForExpression, editor: Editor) { - val parameter = element.getMultiParameter()!! - val range = element.getLoopRange() as JetDotQualifiedExpression - val parameters = parameter.getEntries() - - val loop = JetPsiFactory(element).createExpression("for (${parameters[1].getText()} in _) {}") as JetForExpression - parameter.replace(loop.getLoopParameter()!!) - - range.replace(range.getReceiverExpression()) - } - +public class RemoveForLoopIndicesIntention : JetSelfTargetingIntention(javaClass(), "Remove indices in for-loop") { override fun isApplicableTo(element: JetForExpression, caretOffset: Int): Boolean { val multiParameter = element.getMultiParameter() ?: return false if (multiParameter.getEntries().size() != 2) return false @@ -59,4 +47,15 @@ public class RemoveForLoopIndicesIntention : JetSelfTargetingIntention