From 34780c297919f4ecc0053a1b9586b27602b64a0a Mon Sep 17 00:00:00 2001 From: Vlad Koshkin Date: Thu, 5 Dec 2024 23:14:03 +0100 Subject: [PATCH] [kotlin] K2: Port UnfoldAssignmentToIfIntention ^KTIJ-32031 Fixed GitOrigin-RevId: a50320d11f09db7cc4ab304c68ef87a5b049af97 --- .../after.kt.template | 0 .../before.kt.template | 0 .../description.html | 0 .../kotlin.code-insight.intentions.shared.xml | 7 +++ .../shared}/UnfoldAssignmentToIfIntention.kt | 8 +-- .../SharedK1IntentionTestGenerated.java | 49 +++++++++++++++++++ .../SharedK2IntentionTestGenerated.java | 49 +++++++++++++++++++ .../unfolding/assignmentToIf/.intention | 1 + .../assignmentToIf/innerIfTransformed.kt | 0 .../innerIfTransformed.kt.after | 0 .../unfolding/assignmentToIf/nestedIfs.kt | 0 .../assignmentToIf/nestedIfs.kt.after | 0 .../unfolding/assignmentToIf/simpleIf.kt | 0 .../assignmentToIf/simpleIf.kt.after | 0 .../simpleIfWithAugmentedAssignment.kt | 0 .../simpleIfWithAugmentedAssignment.kt.after | 0 .../assignmentToIf/simpleIfWithBlocks.kt | 0 .../simpleIfWithBlocks.kt.after | 0 .../simpleIfWithComplexAssignmentLHS.kt | 0 .../simpleIfWithComplexAssignmentLHS.kt.after | 0 .../simpleIfWithoutAssignment.kt | 0 .../utils}/BranchedUnfoldingUtils.kt | 2 +- .../UnfoldAssignmentToWhenIntention.kt | 2 +- .../intentions/UnfoldPropertyToIfIntention.kt | 2 +- .../UnfoldPropertyToWhenIntention.kt | 2 +- .../intentions/K1IntentionTestGenerated.java | 49 ------------------- .../unfolding/assignmentToIf/.intention | 1 - .../resources/META-INF/inspections-fe10.xml | 7 --- 28 files changed, 114 insertions(+), 65 deletions(-) rename plugins/kotlin/code-insight/{descriptions => intentions-shared}/resources-en/intentionDescriptions/UnfoldAssignmentToIfIntention/after.kt.template (100%) rename plugins/kotlin/code-insight/{descriptions => intentions-shared}/resources-en/intentionDescriptions/UnfoldAssignmentToIfIntention/before.kt.template (100%) rename plugins/kotlin/code-insight/{descriptions => intentions-shared}/resources-en/intentionDescriptions/UnfoldAssignmentToIfIntention/description.html (100%) rename plugins/kotlin/{idea/src/org/jetbrains/kotlin/idea/intentions/branchedTransformations/intentions => code-insight/intentions-shared/src/org/jetbrains/kotlin/idea/codeInsight/intentions/shared}/UnfoldAssignmentToIfIntention.kt (74%) create mode 100644 plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/unfolding/assignmentToIf/.intention rename plugins/kotlin/{idea/tests/testData/intentions/branched => code-insight/intentions-shared/tests/testData/intentions}/unfolding/assignmentToIf/innerIfTransformed.kt (100%) rename plugins/kotlin/{idea/tests/testData/intentions/branched => code-insight/intentions-shared/tests/testData/intentions}/unfolding/assignmentToIf/innerIfTransformed.kt.after (100%) rename plugins/kotlin/{idea/tests/testData/intentions/branched => code-insight/intentions-shared/tests/testData/intentions}/unfolding/assignmentToIf/nestedIfs.kt (100%) rename plugins/kotlin/{idea/tests/testData/intentions/branched => code-insight/intentions-shared/tests/testData/intentions}/unfolding/assignmentToIf/nestedIfs.kt.after (100%) rename plugins/kotlin/{idea/tests/testData/intentions/branched => code-insight/intentions-shared/tests/testData/intentions}/unfolding/assignmentToIf/simpleIf.kt (100%) rename plugins/kotlin/{idea/tests/testData/intentions/branched => code-insight/intentions-shared/tests/testData/intentions}/unfolding/assignmentToIf/simpleIf.kt.after (100%) rename plugins/kotlin/{idea/tests/testData/intentions/branched => code-insight/intentions-shared/tests/testData/intentions}/unfolding/assignmentToIf/simpleIfWithAugmentedAssignment.kt (100%) rename plugins/kotlin/{idea/tests/testData/intentions/branched => code-insight/intentions-shared/tests/testData/intentions}/unfolding/assignmentToIf/simpleIfWithAugmentedAssignment.kt.after (100%) rename plugins/kotlin/{idea/tests/testData/intentions/branched => code-insight/intentions-shared/tests/testData/intentions}/unfolding/assignmentToIf/simpleIfWithBlocks.kt (100%) rename plugins/kotlin/{idea/tests/testData/intentions/branched => code-insight/intentions-shared/tests/testData/intentions}/unfolding/assignmentToIf/simpleIfWithBlocks.kt.after (100%) rename plugins/kotlin/{idea/tests/testData/intentions/branched => code-insight/intentions-shared/tests/testData/intentions}/unfolding/assignmentToIf/simpleIfWithComplexAssignmentLHS.kt (100%) rename plugins/kotlin/{idea/tests/testData/intentions/branched => code-insight/intentions-shared/tests/testData/intentions}/unfolding/assignmentToIf/simpleIfWithComplexAssignmentLHS.kt.after (100%) rename plugins/kotlin/{idea/tests/testData/intentions/branched => code-insight/intentions-shared/tests/testData/intentions}/unfolding/assignmentToIf/simpleIfWithoutAssignment.kt (100%) rename plugins/kotlin/{idea/src/org/jetbrains/kotlin/idea/intentions/branchedTransformations => code-insight/utils/src/org/jetbrains/kotlin/idea/codeinsight/utils}/BranchedUnfoldingUtils.kt (96%) delete mode 100644 plugins/kotlin/idea/tests/testData/intentions/branched/unfolding/assignmentToIf/.intention diff --git a/plugins/kotlin/code-insight/descriptions/resources-en/intentionDescriptions/UnfoldAssignmentToIfIntention/after.kt.template b/plugins/kotlin/code-insight/intentions-shared/resources-en/intentionDescriptions/UnfoldAssignmentToIfIntention/after.kt.template similarity index 100% rename from plugins/kotlin/code-insight/descriptions/resources-en/intentionDescriptions/UnfoldAssignmentToIfIntention/after.kt.template rename to plugins/kotlin/code-insight/intentions-shared/resources-en/intentionDescriptions/UnfoldAssignmentToIfIntention/after.kt.template diff --git a/plugins/kotlin/code-insight/descriptions/resources-en/intentionDescriptions/UnfoldAssignmentToIfIntention/before.kt.template b/plugins/kotlin/code-insight/intentions-shared/resources-en/intentionDescriptions/UnfoldAssignmentToIfIntention/before.kt.template similarity index 100% rename from plugins/kotlin/code-insight/descriptions/resources-en/intentionDescriptions/UnfoldAssignmentToIfIntention/before.kt.template rename to plugins/kotlin/code-insight/intentions-shared/resources-en/intentionDescriptions/UnfoldAssignmentToIfIntention/before.kt.template diff --git a/plugins/kotlin/code-insight/descriptions/resources-en/intentionDescriptions/UnfoldAssignmentToIfIntention/description.html b/plugins/kotlin/code-insight/intentions-shared/resources-en/intentionDescriptions/UnfoldAssignmentToIfIntention/description.html similarity index 100% rename from plugins/kotlin/code-insight/descriptions/resources-en/intentionDescriptions/UnfoldAssignmentToIfIntention/description.html rename to plugins/kotlin/code-insight/intentions-shared/resources-en/intentionDescriptions/UnfoldAssignmentToIfIntention/description.html diff --git a/plugins/kotlin/code-insight/intentions-shared/resources/kotlin.code-insight.intentions.shared.xml b/plugins/kotlin/code-insight/intentions-shared/resources/kotlin.code-insight.intentions.shared.xml index f9fc351f3eadf..af87670838780 100644 --- a/plugins/kotlin/code-insight/intentions-shared/resources/kotlin.code-insight.intentions.shared.xml +++ b/plugins/kotlin/code-insight/intentions-shared/resources/kotlin.code-insight.intentions.shared.xml @@ -301,5 +301,12 @@ group.names.kotlin + + kotlin + org.jetbrains.kotlin.idea.codeInsight.intentions.shared.UnfoldAssignmentToIfIntention + messages.KotlinBundle + group.names.kotlin + + \ No newline at end of file diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/branchedTransformations/intentions/UnfoldAssignmentToIfIntention.kt b/plugins/kotlin/code-insight/intentions-shared/src/org/jetbrains/kotlin/idea/codeInsight/intentions/shared/UnfoldAssignmentToIfIntention.kt similarity index 74% rename from plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/branchedTransformations/intentions/UnfoldAssignmentToIfIntention.kt rename to plugins/kotlin/code-insight/intentions-shared/src/org/jetbrains/kotlin/idea/codeInsight/intentions/shared/UnfoldAssignmentToIfIntention.kt index 5f2dd33c1984f..c98f3f349f203 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/branchedTransformations/intentions/UnfoldAssignmentToIfIntention.kt +++ b/plugins/kotlin/code-insight/intentions-shared/src/org/jetbrains/kotlin/idea/codeInsight/intentions/shared/UnfoldAssignmentToIfIntention.kt @@ -1,13 +1,13 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions +package org.jetbrains.kotlin.idea.codeInsight.intentions.shared import com.intellij.codeInsight.intention.LowPriorityAction import com.intellij.openapi.editor.Editor import com.intellij.openapi.util.TextRange import org.jetbrains.kotlin.idea.base.resources.KotlinBundle import org.jetbrains.kotlin.idea.codeinsight.api.classic.intentions.SelfTargetingRangeIntention -import org.jetbrains.kotlin.idea.intentions.branchedTransformations.BranchedUnfoldingUtils +import org.jetbrains.kotlin.idea.codeinsight.utils.BranchedUnfoldingUtils import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.KtBinaryExpression import org.jetbrains.kotlin.psi.KtIfExpression @@ -25,5 +25,5 @@ class UnfoldAssignmentToIfIntention : SelfTargetingRangeIntentiongroup.names.kotlin - - kotlin - org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.UnfoldAssignmentToIfIntention - messages.KotlinBundle - group.names.kotlin - - kotlin org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.UnfoldPropertyToIfIntention