mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 20:39:40 +07:00
[kotlin] Share ConvertLambdaLineIntention between k1 and k2
ConvertLambdaLineIntention includes two inheritors: ConvertLambdaToMultiLineIntention and ConvertLambdaToSingleLineIntention ^KTIJ-22968 fixed ^KTIJ-22969 fixed ^KTIJ-22970 fixed GitOrigin-RevId: de729d85dc00f5bb26a5abbf464b4a434822923c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2d252ff519
commit
678f31ee1c
@@ -195,5 +195,19 @@
|
||||
<bundleName>messages.KotlinBundle</bundleName>
|
||||
<categoryKey>group.names.kotlin</categoryKey>
|
||||
</intentionAction>
|
||||
|
||||
<intentionAction>
|
||||
<language>kotlin</language>
|
||||
<className>org.jetbrains.kotlin.idea.codeInsight.intentions.shared.ConvertLambdaToMultiLineIntention</className>
|
||||
<bundleName>messages.KotlinBundle</bundleName>
|
||||
<categoryKey>group.names.kotlin</categoryKey>
|
||||
</intentionAction>
|
||||
|
||||
<intentionAction>
|
||||
<language>kotlin</language>
|
||||
<className>org.jetbrains.kotlin.idea.codeInsight.intentions.shared.ConvertLambdaToSingleLineIntention</className>
|
||||
<bundleName>messages.KotlinBundle</bundleName>
|
||||
<categoryKey>group.names.kotlin</categoryKey>
|
||||
</intentionAction>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -1,6 +1,6 @@
|
||||
// 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
|
||||
package org.jetbrains.kotlin.idea.codeInsight.intentions.shared
|
||||
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.psi.PsiComment
|
||||
@@ -15,7 +15,7 @@ import org.jetbrains.kotlin.psi.psiUtil.allChildren
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getNextSiblingIgnoringWhitespace
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getPrevSiblingIgnoringWhitespace
|
||||
|
||||
sealed class ConvertLambdaLineIntention(private val toMultiLine: Boolean) : SelfTargetingIntention<KtLambdaExpression>(
|
||||
internal sealed class ConvertLambdaLineIntention(private val toMultiLine: Boolean) : SelfTargetingIntention<KtLambdaExpression>(
|
||||
KtLambdaExpression::class.java,
|
||||
KotlinBundle.lazyMessage("intention.convert.lambda.line", 1.takeIf { toMultiLine } ?: 0),
|
||||
) {
|
||||
@@ -60,6 +60,6 @@ sealed class ConvertLambdaLineIntention(private val toMultiLine: Boolean) : Self
|
||||
}
|
||||
}
|
||||
|
||||
class ConvertLambdaToMultiLineIntention : ConvertLambdaLineIntention(toMultiLine = true)
|
||||
internal class ConvertLambdaToMultiLineIntention : ConvertLambdaLineIntention(toMultiLine = true)
|
||||
|
||||
class ConvertLambdaToSingleLineIntention : ConvertLambdaLineIntention(toMultiLine = false)
|
||||
internal class ConvertLambdaToSingleLineIntention : ConvertLambdaLineIntention(toMultiLine = false)
|
||||
@@ -357,6 +357,112 @@ public abstract class SharedK1IntentionTestGenerated extends AbstractSharedK1Int
|
||||
}
|
||||
}
|
||||
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@TestMetadata("../testData/intentions/convertLambdaToMultiLine")
|
||||
public static class ConvertLambdaToMultiLine extends AbstractSharedK1IntentionTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("multiLine.kt")
|
||||
public void testMultiLine() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToMultiLine/multiLine.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToMultiLine/simple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple2.kt")
|
||||
public void testSimple2() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToMultiLine/simple2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple3.kt")
|
||||
public void testSimple3() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToMultiLine/simple3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple4.kt")
|
||||
public void testSimple4() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToMultiLine/simple4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple5.kt")
|
||||
public void testSimple5() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToMultiLine/simple5.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple6.kt")
|
||||
public void testSimple6() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToMultiLine/simple6.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@TestMetadata("../testData/intentions/convertLambdaToSingleLine")
|
||||
public static class ConvertLambdaToSingleLine extends AbstractSharedK1IntentionTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("hasEolComment.kt")
|
||||
public void testHasEolComment() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToSingleLine/hasEolComment.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multiLineBody.kt")
|
||||
public void testMultiLineBody() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToSingleLine/multiLineBody.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multiLineBody2.kt")
|
||||
public void testMultiLineBody2() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToSingleLine/multiLineBody2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multiLineBody3.kt")
|
||||
public void testMultiLineBody3() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToSingleLine/multiLineBody3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToSingleLine/simple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple2.kt")
|
||||
public void testSimple2() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToSingleLine/simple2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple3.kt")
|
||||
public void testSimple3() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToSingleLine/simple3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple4.kt")
|
||||
public void testSimple4() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToSingleLine/simple4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple5.kt")
|
||||
public void testSimple5() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToSingleLine/simple5.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple6.kt")
|
||||
public void testSimple6() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToSingleLine/simple6.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("singleLine.kt")
|
||||
public void testSingleLine() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToSingleLine/singleLine.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@TestMetadata("../testData/intentions/convertLineCommentToBlockComment")
|
||||
public static class ConvertLineCommentToBlockComment extends AbstractSharedK1IntentionTest {
|
||||
|
||||
@@ -357,6 +357,112 @@ public abstract class SharedK2IntentionTestGenerated extends AbstractSharedK2Int
|
||||
}
|
||||
}
|
||||
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@TestMetadata("../testData/intentions/convertLambdaToMultiLine")
|
||||
public static class ConvertLambdaToMultiLine extends AbstractSharedK2IntentionTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("multiLine.kt")
|
||||
public void testMultiLine() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToMultiLine/multiLine.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToMultiLine/simple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple2.kt")
|
||||
public void testSimple2() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToMultiLine/simple2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple3.kt")
|
||||
public void testSimple3() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToMultiLine/simple3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple4.kt")
|
||||
public void testSimple4() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToMultiLine/simple4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple5.kt")
|
||||
public void testSimple5() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToMultiLine/simple5.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple6.kt")
|
||||
public void testSimple6() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToMultiLine/simple6.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@TestMetadata("../testData/intentions/convertLambdaToSingleLine")
|
||||
public static class ConvertLambdaToSingleLine extends AbstractSharedK2IntentionTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("hasEolComment.kt")
|
||||
public void testHasEolComment() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToSingleLine/hasEolComment.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multiLineBody.kt")
|
||||
public void testMultiLineBody() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToSingleLine/multiLineBody.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multiLineBody2.kt")
|
||||
public void testMultiLineBody2() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToSingleLine/multiLineBody2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multiLineBody3.kt")
|
||||
public void testMultiLineBody3() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToSingleLine/multiLineBody3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToSingleLine/simple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple2.kt")
|
||||
public void testSimple2() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToSingleLine/simple2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple3.kt")
|
||||
public void testSimple3() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToSingleLine/simple3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple4.kt")
|
||||
public void testSimple4() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToSingleLine/simple4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple5.kt")
|
||||
public void testSimple5() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToSingleLine/simple5.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple6.kt")
|
||||
public void testSimple6() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToSingleLine/simple6.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("singleLine.kt")
|
||||
public void testSingleLine() throws Exception {
|
||||
runTest("../testData/intentions/convertLambdaToSingleLine/singleLine.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@TestMetadata("../testData/intentions/convertLineCommentToBlockComment")
|
||||
public static class ConvertLineCommentToBlockComment extends AbstractSharedK2IntentionTest {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.codeInsight.intentions.shared.ConvertLambdaToMultiLineIntention
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.codeInsight.intentions.shared.ConvertLambdaToSingleLineIntention
|
||||
@@ -5810,49 +5810,6 @@ public abstract class K1IntentionTestGenerated extends AbstractK1IntentionTest {
|
||||
}
|
||||
}
|
||||
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@TestMetadata("testData/intentions/convertLambdaToMultiLine")
|
||||
public static class ConvertLambdaToMultiLine extends AbstractK1IntentionTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("multiLine.kt")
|
||||
public void testMultiLine() throws Exception {
|
||||
runTest("testData/intentions/convertLambdaToMultiLine/multiLine.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("testData/intentions/convertLambdaToMultiLine/simple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple2.kt")
|
||||
public void testSimple2() throws Exception {
|
||||
runTest("testData/intentions/convertLambdaToMultiLine/simple2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple3.kt")
|
||||
public void testSimple3() throws Exception {
|
||||
runTest("testData/intentions/convertLambdaToMultiLine/simple3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple4.kt")
|
||||
public void testSimple4() throws Exception {
|
||||
runTest("testData/intentions/convertLambdaToMultiLine/simple4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple5.kt")
|
||||
public void testSimple5() throws Exception {
|
||||
runTest("testData/intentions/convertLambdaToMultiLine/simple5.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple6.kt")
|
||||
public void testSimple6() throws Exception {
|
||||
runTest("testData/intentions/convertLambdaToMultiLine/simple6.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@TestMetadata("testData/intentions/convertLambdaToReference")
|
||||
public abstract static class ConvertLambdaToReference extends AbstractK1IntentionTest {
|
||||
@@ -6553,69 +6510,6 @@ public abstract class K1IntentionTestGenerated extends AbstractK1IntentionTest {
|
||||
}
|
||||
}
|
||||
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@TestMetadata("testData/intentions/convertLambdaToSingleLine")
|
||||
public static class ConvertLambdaToSingleLine extends AbstractK1IntentionTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("hasEolComment.kt")
|
||||
public void testHasEolComment() throws Exception {
|
||||
runTest("testData/intentions/convertLambdaToSingleLine/hasEolComment.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multiLineBody.kt")
|
||||
public void testMultiLineBody() throws Exception {
|
||||
runTest("testData/intentions/convertLambdaToSingleLine/multiLineBody.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multiLineBody2.kt")
|
||||
public void testMultiLineBody2() throws Exception {
|
||||
runTest("testData/intentions/convertLambdaToSingleLine/multiLineBody2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multiLineBody3.kt")
|
||||
public void testMultiLineBody3() throws Exception {
|
||||
runTest("testData/intentions/convertLambdaToSingleLine/multiLineBody3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("testData/intentions/convertLambdaToSingleLine/simple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple2.kt")
|
||||
public void testSimple2() throws Exception {
|
||||
runTest("testData/intentions/convertLambdaToSingleLine/simple2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple3.kt")
|
||||
public void testSimple3() throws Exception {
|
||||
runTest("testData/intentions/convertLambdaToSingleLine/simple3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple4.kt")
|
||||
public void testSimple4() throws Exception {
|
||||
runTest("testData/intentions/convertLambdaToSingleLine/simple4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple5.kt")
|
||||
public void testSimple5() throws Exception {
|
||||
runTest("testData/intentions/convertLambdaToSingleLine/simple5.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple6.kt")
|
||||
public void testSimple6() throws Exception {
|
||||
runTest("testData/intentions/convertLambdaToSingleLine/simple6.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("singleLine.kt")
|
||||
public void testSingleLine() throws Exception {
|
||||
runTest("testData/intentions/convertLambdaToSingleLine/singleLine.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@TestMetadata("testData/intentions/convertLateinitPropertyToNullable")
|
||||
public static class ConvertLateinitPropertyToNullable extends AbstractK1IntentionTest {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
org.jetbrains.kotlin.idea.intentions.ConvertLambdaToMultiLineIntention
|
||||
@@ -1 +0,0 @@
|
||||
org.jetbrains.kotlin.idea.intentions.ConvertLambdaToSingleLineIntention
|
||||
@@ -924,20 +924,6 @@
|
||||
<categoryKey>group.names.kotlin</categoryKey>
|
||||
</intentionAction>
|
||||
|
||||
<intentionAction>
|
||||
<language>kotlin</language>
|
||||
<className>org.jetbrains.kotlin.idea.intentions.ConvertLambdaToMultiLineIntention</className>
|
||||
<bundleName>messages.KotlinBundle</bundleName>
|
||||
<categoryKey>group.names.kotlin</categoryKey>
|
||||
</intentionAction>
|
||||
|
||||
<intentionAction>
|
||||
<language>kotlin</language>
|
||||
<className>org.jetbrains.kotlin.idea.intentions.ConvertLambdaToSingleLineIntention</className>
|
||||
<bundleName>messages.KotlinBundle</bundleName>
|
||||
<categoryKey>group.names.kotlin</categoryKey>
|
||||
</intentionAction>
|
||||
|
||||
<intentionAction>
|
||||
<language>kotlin</language>
|
||||
<className>org.jetbrains.kotlin.idea.intentions.ExpandBooleanExpressionIntention</className>
|
||||
|
||||
Reference in New Issue
Block a user