mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[kotlin] Improve message to reflect type of element to be safe deleted
#KTIJ-27923 Fixed GitOrigin-RevId: 3cd7b6f90a693b5aa8c1082aa82a4e9e5d4e8719
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2439ed75b3
commit
0961a7aeab
+26
-2
@@ -218,8 +218,32 @@ public final class ActionHint {
|
||||
}
|
||||
|
||||
assert comment != null : commenter;
|
||||
// "quick fix action text to perform" "should be available"
|
||||
Pattern pattern = Pattern.compile("^" + Pattern.quote(comment) + " \"(.*)\" \"(\\w+)(?:-(\\w+))?\".*", Pattern.DOTALL);
|
||||
return parse(file, contents, Pattern.quote(comment), exactMatch);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse given file with given contents extracting ActionHint of it.
|
||||
* <p>
|
||||
* Currently the following syntax is supported:
|
||||
* </p>
|
||||
* {@code $commentPrefix "quick-fix name or intention text[|->next step]" "true|false|<ProblemHighlightType>[-preview]"}
|
||||
* <p>
|
||||
* If {@link ProblemHighlightType} enum value is specified instead of true/false
|
||||
* (e.g. {@code "INFORMATION"}), then
|
||||
* it's expected that the action is present and it's a quick-fix with given highlight type.
|
||||
* </p>
|
||||
*
|
||||
* @param file PsiFile associated with contents (used to determine the language)
|
||||
* @param contents file contents
|
||||
* @param commentPrefix any custom specific prefix, could be a regexp
|
||||
* @param exactMatch if false then action hint matches prefix like in {@link CodeInsightTestFixture#filterAvailableIntentions(String)}
|
||||
* @return ActionHint object
|
||||
* @throws AssertionError if action hint is absent or has invalid format
|
||||
*/
|
||||
@NotNull
|
||||
public static ActionHint parse(@NotNull PsiFile file, @NotNull String contents, @NotNull String commentPrefix, boolean exactMatch) {
|
||||
// $commentPrefix "quick fix action text to perform" "should be available"
|
||||
Pattern pattern = Pattern.compile("^" + commentPrefix + " \"([^\n]*)\" \"(\\w+)(?:-(\\w+))?\".*", Pattern.DOTALL);
|
||||
Matcher matcher = pattern.matcher(contents);
|
||||
TestCase.assertTrue("No comment found in " + file.getVirtualFile(), matcher.matches());
|
||||
final String text = matcher.group(1);
|
||||
|
||||
+7
-4
@@ -3,7 +3,6 @@
|
||||
package org.jetbrains.kotlin.idea.fir.quickfix
|
||||
|
||||
import com.intellij.codeInsight.intention.IntentionAction
|
||||
import com.intellij.codeInspection.InspectionProfileEntry
|
||||
import com.intellij.testFramework.runInEdtAndWait
|
||||
import org.jetbrains.kotlin.idea.fir.invalidateCaches
|
||||
import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest
|
||||
@@ -19,6 +18,7 @@ abstract class AbstractHighLevelQuickFixTest : AbstractQuickFixTest() {
|
||||
}
|
||||
|
||||
override fun isFirPlugin(): Boolean = true
|
||||
|
||||
override fun tearDown() {
|
||||
runAll(
|
||||
{ runInEdtAndWait { project.invalidateCaches() } },
|
||||
@@ -59,8 +59,11 @@ abstract class AbstractHighLevelQuickFixTest : AbstractQuickFixTest() {
|
||||
|
||||
// TODO: Enable these as more actions/inspections are enabled, and/or add more FIR-specific directives
|
||||
override fun checkForUnexpectedErrors() {}
|
||||
|
||||
override val inspectionFileName: String
|
||||
get() = ".k2Inspection"
|
||||
|
||||
override val actionPrefix: String? = "K2_ACTION:"
|
||||
|
||||
override fun checkAvailableActionsAreExpected(actions: List<IntentionAction>) {}
|
||||
override fun parseInspectionsToEnable(beforeFileName: String, beforeFileText: String): List<InspectionProfileEntry> {
|
||||
return emptyList()
|
||||
}
|
||||
}
|
||||
|
||||
+146
@@ -4695,7 +4695,153 @@ public abstract class HighLevelQuickFixTestGenerated extends AbstractHighLevelQu
|
||||
|
||||
|
||||
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@TestMetadata("../../idea/tests/testData/quickfix/removeUnused")
|
||||
public static class RemoveUnused extends AbstractHighLevelQuickFixTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("companionViaImport3.kt")
|
||||
public void testCompanionViaImport3() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/companionViaImport3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("deledage.kt")
|
||||
public void testDeledage() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/deledage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("importEnumValues.kt")
|
||||
public void testImportEnumValues() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/importEnumValues.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("importObjectFun.kt")
|
||||
public void testImportObjectFun() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/importObjectFun.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("notTriangle.kt")
|
||||
public void testNotTriangle() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/notTriangle.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("secondaryLocalClassConstructor.kt")
|
||||
public void testSecondaryLocalClassConstructor() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/secondaryLocalClassConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleUnusedEnumEntry.kt")
|
||||
public void testSimpleUnusedEnumEntry() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/simpleUnusedEnumEntry.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("triangle.kt")
|
||||
public void testTriangle() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/triangle.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("triangle2.kt")
|
||||
public void testTriangle2() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/triangle2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeAlias2.kt")
|
||||
public void testTypeAlias2() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/typeAlias2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unusedClass.kt")
|
||||
public void testUnusedClass() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/unusedClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unusedConstructor.kt")
|
||||
public void testUnusedConstructor() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/unusedConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unusedDelegatedConstructor.kt")
|
||||
public void testUnusedDelegatedConstructor() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/unusedDelegatedConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unusedDelegatedConstructorSuper.kt")
|
||||
public void testUnusedDelegatedConstructorSuper() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/unusedDelegatedConstructorSuper.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unusedEnumEntry.kt")
|
||||
public void testUnusedEnumEntry() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/unusedEnumEntry.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unusedEnumEntry2.kt")
|
||||
public void testUnusedEnumEntry2() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/unusedEnumEntry2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unusedEnumEntry3.kt")
|
||||
public void testUnusedEnumEntry3() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/unusedEnumEntry3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unusedEnumEntry4.kt")
|
||||
public void testUnusedEnumEntry4() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/unusedEnumEntry4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unusedEnumEntry5.kt")
|
||||
public void testUnusedEnumEntry5() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/unusedEnumEntry5.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unusedFunction.kt")
|
||||
public void testUnusedFunction() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/unusedFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unusedProperty.kt")
|
||||
public void testUnusedProperty() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/unusedProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unusedPropertyAsConstructorParameter.kt")
|
||||
public void testUnusedPropertyAsConstructorParameter() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/unusedPropertyAsConstructorParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unusedPropertyAsConstructorParameter2.kt")
|
||||
public void testUnusedPropertyAsConstructorParameter2() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/unusedPropertyAsConstructorParameter2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unusedTypeParameter.kt")
|
||||
public void testUnusedTypeParameter() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/unusedTypeParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("usedClassAsAlias.kt")
|
||||
public void testUsedClassAsAlias() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/usedClassAsAlias.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("usedFunAsAlias.kt")
|
||||
public void testUsedFunAsAlias() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/usedFunAsAlias.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("usedObjectAsAlias.kt")
|
||||
public void testUsedObjectAsAlias() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/usedObjectAsAlias.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("usedVarAsAlias.kt")
|
||||
public void testUsedVarAsAlias() throws Exception {
|
||||
runTest("../../idea/tests/testData/quickfix/removeUnused/usedVarAsAlias.kt");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
+9
-1
@@ -199,7 +199,15 @@ class KotlinRefsHolder {
|
||||
class SafeDeleteFix(declaration: KtNamedDeclaration) : LocalQuickFixAndIntentionActionOnPsiElement(declaration) {
|
||||
@Nls
|
||||
private val name: String =
|
||||
KotlinBaseHighlightingBundle.message("safe.delete.text", declaration.name ?: declaration.text)
|
||||
KotlinBaseHighlightingBundle.message(declaration.toNameKey(), declaration.name ?: declaration.text)
|
||||
|
||||
private fun KtNamedDeclaration.toNameKey(): String =
|
||||
when (this) {
|
||||
is KtPrimaryConstructor -> "safe.delete.primary.ctor.text.0"
|
||||
is KtSecondaryConstructor -> "safe.delete.secondary.ctor.text.0"
|
||||
is KtParameter -> "safe.delete.parameter.text.0"
|
||||
else -> "safe.delete.text.0"
|
||||
}
|
||||
|
||||
override fun getText(): @IntentionName String {
|
||||
return name
|
||||
|
||||
+4
-1
@@ -9,4 +9,7 @@ smart.cast.to.0=Smart cast to {0}
|
||||
|
||||
inspection.message.never.used={0} is never used
|
||||
safe.delete.family=Safe delete
|
||||
safe.delete.text=Safe delete ''{0}''
|
||||
safe.delete.text.0=Safe delete ''{0}''
|
||||
safe.delete.secondary.ctor.text.0=Safe delete secondary constructor ''{0}''
|
||||
safe.delete.primary.ctor.text.0=Safe delete primary constructor ''{0}''
|
||||
safe.delete.parameter.text.0=Safe delete parameter ''{0}''
|
||||
|
||||
+2
@@ -17,4 +17,6 @@ abstract class AbstractK1QuickFixTest : AbstractQuickFixTest() {
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
override val actionPrefix: String? = "K1_ACTION:"
|
||||
}
|
||||
+14
-5
@@ -8,6 +8,7 @@ import com.intellij.codeInsight.intention.IntentionActionDelegate
|
||||
import com.intellij.codeInsight.intention.PriorityAction
|
||||
import com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler
|
||||
import com.intellij.codeInsight.intention.impl.config.IntentionManagerSettings
|
||||
import com.intellij.codeInspection.LocalQuickFixOnPsiElement
|
||||
import com.intellij.codeInspection.SuppressableProblemGroup
|
||||
import com.intellij.codeInspection.ex.QuickFixWrapper
|
||||
import com.intellij.internal.statistic.eventLog.StatisticsEventLoggerProvider
|
||||
@@ -21,8 +22,9 @@ import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.openapi.vfs.CharsetToolkit
|
||||
import com.intellij.psi.util.PsiUtilBase
|
||||
import com.intellij.platform.testFramework.core.FileComparisonFailedError
|
||||
import com.intellij.psi.PsiFile
|
||||
import com.intellij.psi.util.PsiUtilBase
|
||||
import com.intellij.testFramework.*
|
||||
import com.intellij.util.ui.UIUtil
|
||||
import junit.framework.TestCase
|
||||
@@ -240,13 +242,13 @@ abstract class AbstractQuickFixTest : KotlinLightCodeInsightFixtureTestCase(), Q
|
||||
|
||||
configExtra(fileText)
|
||||
|
||||
val hint = ActionHint.parse(myFixture.file, contents.replace("\${file}", fileName, ignoreCase = true))
|
||||
val hint = myFixture.file.actionHint(contents.replace("\${file}", fileName, ignoreCase = true))
|
||||
actionHint = hint
|
||||
val intention = runInEdtAndGet { findActionWithText(hint.expectedText) }
|
||||
if (hint.shouldPresent()) {
|
||||
if (intention == null) {
|
||||
fail(
|
||||
"Action with text '" + hint.expectedText + "' not found\nAvailable actions:\n" +
|
||||
"Action with text '" + hint.expectedText + "' not found\n${myFixture.availableIntentions.size} available actions:\n" +
|
||||
myFixture.availableIntentions.joinToString(separator = "\n") { "// \"${it.text}\" \"true\"" })
|
||||
return
|
||||
}
|
||||
@@ -290,13 +292,18 @@ abstract class AbstractQuickFixTest : KotlinLightCodeInsightFixtureTestCase(), Q
|
||||
ConfigLibraryUtil.unconfigureLibrariesByDirective(myFixture.module, fileText)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun PsiFile.actionHint(contents: String): ActionHint {
|
||||
return ActionHint.parse(this, contents,
|
||||
actionPrefix?.let { ".*//(?: $it)?" } ?: "//",
|
||||
true)
|
||||
}
|
||||
|
||||
private fun applyAction(contents: String, hint: ActionHint, intention: IntentionAction, fileName: String) {
|
||||
val unwrappedIntention = unwrapIntention(intention)
|
||||
if (shouldCheckIntentionActionType) {
|
||||
if (intention.asModCommandAction() == null) {
|
||||
if (intention.asModCommandAction() == null && unwrappedIntention !is LocalQuickFixOnPsiElement) {
|
||||
assertInstanceOf(unwrappedIntention, QuickFixActionBase::class.java)
|
||||
}
|
||||
}
|
||||
@@ -365,7 +372,7 @@ abstract class AbstractQuickFixTest : KotlinLightCodeInsightFixtureTestCase(), Q
|
||||
|
||||
private fun checkForUnexpectedActions() {
|
||||
val text = myFixture.editor.document.text
|
||||
val actionHint = ActionHint.parse(myFixture.file, text)
|
||||
val actionHint = myFixture.file.actionHint(text)
|
||||
if (actionHint.shouldPresent() && !InTextDirectivesUtils.isDirectiveDefined(text, DirectiveBasedActionUtils.ACTION_DIRECTIVE)) {
|
||||
return
|
||||
}
|
||||
@@ -438,4 +445,6 @@ abstract class AbstractQuickFixTest : KotlinLightCodeInsightFixtureTestCase(), Q
|
||||
|
||||
override val additionalToolDirectives: Array<String>
|
||||
get() = arrayOf(if (isFirPlugin) K2_TOOL_DIRECTIVE else K1_TOOL_DIRECTIVE)
|
||||
|
||||
protected open val actionPrefix: String? = null
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.k2.codeinsight.inspections.UnusedSymbolInspection
|
||||
@@ -6,4 +6,5 @@ class TestClass{
|
||||
const val CONST = "abc"
|
||||
}
|
||||
}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
/* IGNORE_K2 */
|
||||
+2
-1
@@ -2,4 +2,5 @@
|
||||
|
||||
class TestClass{
|
||||
}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
/* IGNORE_K2 */
|
||||
@@ -7,4 +7,5 @@ abstract class Abstract {
|
||||
class Test: Abstract() {
|
||||
}
|
||||
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
@@ -6,4 +6,5 @@ abstract class Abstract {
|
||||
class Test: Abstract() {
|
||||
}
|
||||
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
+4
-2
@@ -1,4 +1,5 @@
|
||||
// "Safe delete constructor" "true"
|
||||
// K1_ACTION: "Safe delete constructor" "true"
|
||||
// K2_ACTION: "Safe delete secondary constructor 'LocalClass'" "true"
|
||||
fun main() {
|
||||
class LocalClass(val number: Int) {
|
||||
<caret>constructor(s: String) : this(s.toInt())
|
||||
@@ -6,4 +7,5 @@ fun main() {
|
||||
|
||||
val l = LocalClass(42)
|
||||
}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
+4
-2
@@ -1,8 +1,10 @@
|
||||
// "Safe delete constructor" "true"
|
||||
// K1_ACTION: "Safe delete constructor" "true"
|
||||
// K2_ACTION: "Safe delete secondary constructor 'LocalClass'" "true"
|
||||
fun main() {
|
||||
class LocalClass(val number: Int) {
|
||||
}
|
||||
|
||||
val l = LocalClass(42)
|
||||
}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
@@ -7,4 +7,5 @@ enum class MyEnum {
|
||||
fun main() {
|
||||
MyEnum.HELLO
|
||||
}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
+2
-1
@@ -6,4 +6,5 @@ enum class MyEnum {
|
||||
fun main() {
|
||||
MyEnum.HELLO
|
||||
}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
@@ -8,4 +8,5 @@ enum class MyEnum {
|
||||
|
||||
typealias Other<caret> = MyEnum
|
||||
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
/* IGNORE_K2 */
|
||||
@@ -5,4 +5,5 @@ enum class MyEnum {
|
||||
WORLD
|
||||
}
|
||||
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
/* IGNORE_K2 */
|
||||
@@ -3,4 +3,5 @@ class DummyClass
|
||||
|
||||
class <caret>UnusedClass
|
||||
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
@@ -1,4 +1,5 @@
|
||||
// "Safe delete 'UnusedClass'" "true"
|
||||
class DummyClass
|
||||
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
@@ -1,5 +1,7 @@
|
||||
// "Safe delete constructor" "true"
|
||||
// K1_ACTION: "Safe delete constructor" "true"
|
||||
// K2_ACTION: "Safe delete secondary constructor 'Owner'" "true"
|
||||
class Owner(val x: Int) {
|
||||
<caret>constructor(): this(42)
|
||||
}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
@@ -1,4 +1,6 @@
|
||||
// "Safe delete constructor" "true"
|
||||
// K1_ACTION: "Safe delete constructor" "true"
|
||||
// K2_ACTION: "Safe delete secondary constructor 'Owner'" "true"
|
||||
class Owner(val x: Int) {
|
||||
}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
@@ -11,4 +11,5 @@ enum class MyEnum(val i: Int) {
|
||||
fun test() {
|
||||
MyEnum.HELLO
|
||||
}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
@@ -10,4 +10,5 @@ enum class MyEnum(val i: Int) {
|
||||
fun test() {
|
||||
MyEnum.HELLO
|
||||
}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
@@ -10,4 +10,5 @@ enum class MyEnum(val i: Int) {
|
||||
fun test() {
|
||||
MyEnum.HELLO
|
||||
}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
@@ -9,4 +9,5 @@ enum class MyEnum(val i: Int) {
|
||||
fun test() {
|
||||
MyEnum.HELLO
|
||||
}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
@@ -3,4 +3,5 @@ enum class MyEnum {
|
||||
HELLO<caret>
|
||||
}
|
||||
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
@@ -2,4 +2,5 @@
|
||||
enum class MyEnum {
|
||||
}
|
||||
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
@@ -3,4 +3,5 @@ enum class MyEnum {
|
||||
HELLO<caret>,
|
||||
}
|
||||
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
@@ -2,4 +2,5 @@
|
||||
enum class MyEnum {
|
||||
}
|
||||
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
@@ -5,4 +5,5 @@ enum class MyEnum {
|
||||
HELLO<caret>,
|
||||
}
|
||||
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
@@ -3,4 +3,5 @@
|
||||
enum class MyEnum {
|
||||
}
|
||||
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
@@ -6,4 +6,5 @@ fun <caret>unusedFun() {
|
||||
|
||||
}
|
||||
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
@@ -2,4 +2,5 @@
|
||||
fun dummy() {
|
||||
}
|
||||
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
@@ -3,4 +3,5 @@ class UnusedProperty() {
|
||||
val <caret>property: String = ":)"
|
||||
}
|
||||
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
@@ -2,4 +2,5 @@
|
||||
class UnusedProperty() {
|
||||
}
|
||||
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
+5
-2
@@ -1,4 +1,7 @@
|
||||
// "Safe delete 'property'" "true"
|
||||
// K1_ACTION: "Safe delete 'property'" "true"
|
||||
// K2_ACTION: "Safe delete parameter 'property'" "true"
|
||||
class UnusedPropertyAsConstructorParameter(val <caret>property: String)
|
||||
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
/* IGNORE_K2 */
|
||||
+5
-2
@@ -1,4 +1,7 @@
|
||||
// "Safe delete 'property'" "true"
|
||||
// K1_ACTION: "Safe delete 'property'" "true"
|
||||
// K2_ACTION: "Safe delete parameter 'property'" "true"
|
||||
class UnusedPropertyAsConstructorParameter<caret>
|
||||
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
/* IGNORE_K2 */
|
||||
+4
-2
@@ -1,4 +1,6 @@
|
||||
// "Safe delete 'property'" "true"
|
||||
// K1_ACTION: "Safe delete 'property'" "true"
|
||||
// K2_ACTION: "Safe delete parameter 'property'" "true"
|
||||
class UnusedPropertyAsConstructorParameter(val <caret>property: String, val foo: String)
|
||||
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
+4
-2
@@ -1,4 +1,6 @@
|
||||
// "Safe delete 'property'" "true"
|
||||
// K1_ACTION: "Safe delete 'property'" "true"
|
||||
// K2_ACTION: "Safe delete parameter 'property'" "true"
|
||||
class UnusedPropertyAsConstructorParameter(<caret>val foo: String)
|
||||
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
@@ -1,4 +1,5 @@
|
||||
// "Safe delete 'T'" "true"
|
||||
class UnusedTypeParameter<<caret>T, P>(val p: P)
|
||||
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
// "Safe delete 'T'" "true"
|
||||
class UnusedTypeParameter<P>(val p: P)
|
||||
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix
|
||||
+1
-1
@@ -311,7 +311,7 @@ private fun assembleWorkspace(): TWorkspace = workspace {
|
||||
model("quickfix/removeSuspend", pattern = pattern, isIgnored = true)
|
||||
model("quickfix/removeToStringInStringTemplate", pattern = pattern, isIgnored = true)
|
||||
model("quickfix/removeTypeVariance", pattern = pattern, isIgnored = true)
|
||||
model("quickfix/removeUnused", pattern = pattern, isIgnored = true)
|
||||
model("quickfix/removeUnused", pattern = pattern)
|
||||
model("quickfix/removeUnusedParameter", pattern = pattern, isIgnored = true)
|
||||
model("quickfix/removeUnusedReceiver", pattern = pattern, isIgnored = true)
|
||||
model("quickfix/removeUseSiteTarget", pattern = pattern, isIgnored = true)
|
||||
|
||||
Reference in New Issue
Block a user