From 98c5dd2a8b01ffc24e29c80bbb767ae1038a54b1 Mon Sep 17 00:00:00 2001 From: Alexey Belkov Date: Tue, 11 Apr 2023 11:19:48 +0400 Subject: [PATCH] [kotlin] Unify names of String intentions GitOrigin-RevId: 073001f58a6ab697b34cd3968b7d7de041e0267a --- .../resources-en/messages/KotlinBundle.properties | 6 +++--- .../codeinsight/intentions/ToRawStringLiteralIntention.kt | 2 +- .../idea/intentions/ToOrdinaryStringLiteralIntention.kt | 2 +- .../kotlin/idea/intentions/ToRawStringLiteralIntention.kt | 2 +- .../idea/quickfix/KotlinQuickFixIntentionPreviewTest.kt | 2 +- .../testData/quickfix/autoImports/delegateNoOperator.test | 2 +- .../addFunctionParameterForTypeMismatch5.kt | 4 ++-- .../createClass/callExpression/callWithExtraArgs.kt | 8 ++++---- .../testData/quickfix/suppress/external/suppressActive.kt | 4 ++-- .../testData/quickfix/suppress/redundant/Suppressed.kt | 2 +- .../startWithBackslashInString.kt | 4 ++-- .../addArrayOfTypeForJavaAnnotation.before.Main.kt | 6 +++--- .../quickfix/typeMismatch/incompatibleTypes/char2.kt | 2 +- .../quickfix/typeMismatch/letStringImplementInterface.kt | 4 ++-- .../parameterTypeMismatch/changeFunctionParameterType4.kt | 4 ++-- .../quickfix/typeMismatch/variableInitializedWithNull2.kt | 4 ++-- .../quickfix/typeMismatch/variableInitializedWithNull3.kt | 4 ++-- .../quickfix/typeMismatch/variableInitializedWithNull4.kt | 4 ++-- .../wrapWithCollectionLiteral/inAnnotation.kt | 4 ++-- 19 files changed, 35 insertions(+), 35 deletions(-) diff --git a/plugins/kotlin/base/resources/resources-en/messages/KotlinBundle.properties b/plugins/kotlin/base/resources/resources-en/messages/KotlinBundle.properties index b8520ed4d202..aa4c24247d6c 100644 --- a/plugins/kotlin/base/resources/resources-en/messages/KotlinBundle.properties +++ b/plugins/kotlin/base/resources/resources-en/messages/KotlinBundle.properties @@ -1734,7 +1734,7 @@ convert.template.to.concatenated.string=Convert template to concatenated string replace.with.a.foreach.function.call=Replace with a ''{0}'' function call convert.concatenation.to.raw.string=Convert concatenation to raw string convert.concatenation.to.template.before.text='String' concatenation can be converted to a template -convert.concatenation.to.template=Convert 'String' concatenation to a template +convert.concatenation.to.template=Convert concatenation to template convert.try.finally.to.use.before.text=try-finally can be replaced with 'use()' convert.try.finally.to.use=Replace 'try-finally' with 'use()' convert.to.unsafe.cast=Convert to unsafe cast @@ -1844,8 +1844,8 @@ flip.0=Flip ''{0}'' flip.binary.expression=Flip binary expression flip.equals=Flip 'equals' replace.with.infix.function.call=Replace with infix function call -to.ordinary.string.literal=To ordinary string literal -to.raw.string.literal=To raw string literal +convert.to.ordinary.string.literal=Convert to ordinary string literal +convert.to.raw.string.literal=Convert to raw string literal remove.underscores=Remove underscores add.underscores=Add underscores excluded.methods=Excluded methods diff --git a/plugins/kotlin/code-insight/intentions-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/intentions/ToRawStringLiteralIntention.kt b/plugins/kotlin/code-insight/intentions-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/intentions/ToRawStringLiteralIntention.kt index 93950496e075..e07d63c2dc0a 100644 --- a/plugins/kotlin/code-insight/intentions-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/intentions/ToRawStringLiteralIntention.kt +++ b/plugins/kotlin/code-insight/intentions-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/intentions/ToRawStringLiteralIntention.kt @@ -16,7 +16,7 @@ import org.jetbrains.kotlin.psi.KtStringTemplateExpression internal class ToRawStringLiteralIntention : AbstractKotlinApplicableIntention( KtStringTemplateExpression::class ), LowPriorityAction { - override fun getFamilyName() = KotlinBundle.message("to.raw.string.literal") + override fun getFamilyName() = KotlinBundle.message("convert.to.raw.string.literal") override fun getActionName(element: KtStringTemplateExpression) = familyName diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/ToOrdinaryStringLiteralIntention.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/ToOrdinaryStringLiteralIntention.kt index 1ac658c66ac6..8be5b95c047b 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/ToOrdinaryStringLiteralIntention.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/ToOrdinaryStringLiteralIntention.kt @@ -17,7 +17,7 @@ import org.jetbrains.kotlin.psi.psiUtil.startOffset class ToOrdinaryStringLiteralIntention : SelfTargetingOffsetIndependentIntention( KtStringTemplateExpression::class.java, - KotlinBundle.lazyMessage("to.ordinary.string.literal") + KotlinBundle.lazyMessage("convert.to.ordinary.string.literal") ), LowPriorityAction { companion object { private val TRIM_INDENT_FUNCTIONS = listOf(FqName("kotlin.text.trimIndent"), FqName("kotlin.text.trimMargin")) diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/ToRawStringLiteralIntention.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/ToRawStringLiteralIntention.kt index 5f8ef381d3b6..a55d6ff4d0fa 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/ToRawStringLiteralIntention.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/ToRawStringLiteralIntention.kt @@ -19,7 +19,7 @@ import org.jetbrains.kotlin.psi.psiUtil.startOffset class ToRawStringLiteralIntention : SelfTargetingOffsetIndependentIntention( KtStringTemplateExpression::class.java, - KotlinBundle.lazyMessage("to.raw.string.literal") + KotlinBundle.lazyMessage("convert.to.raw.string.literal") ), LowPriorityAction { override fun isApplicableTo(element: KtStringTemplateExpression): Boolean { if (PsiTreeUtil.nextLeaf(element) is PsiErrorElement) { diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/KotlinQuickFixIntentionPreviewTest.kt b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/KotlinQuickFixIntentionPreviewTest.kt index d1ac12b6c949..373c54329e05 100644 --- a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/KotlinQuickFixIntentionPreviewTest.kt +++ b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/KotlinQuickFixIntentionPreviewTest.kt @@ -29,7 +29,7 @@ class KotlinQuickFixIntentionPreviewTest : KotlinLightCodeInsightFixtureTestCase val code = "intention" println("Hello World!" + code) }""".trimIndent(), - "Convert 'String' concatenation to a template", + "Convert concatenation to template", """ fun main() { val code = "intention" diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/delegateNoOperator.test b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/delegateNoOperator.test index 2e9b77f61e0c..4ec96f7e4854 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/delegateNoOperator.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/delegateNoOperator.test @@ -2,7 +2,7 @@ // "Import" "false" // ERROR: Type 'String' has no method 'getValue(Nothing?, KProperty<*>)' and thus it cannot serve as a delegate // ACTION: Convert to 'buildString' call -// ACTION: To raw string literal +// ACTION: Convert to raw string literal package b diff --git a/plugins/kotlin/idea/tests/testData/quickfix/changeSignature/addFunctionParameterForTypeMismatch5.kt b/plugins/kotlin/idea/tests/testData/quickfix/changeSignature/addFunctionParameterForTypeMismatch5.kt index 98ac980566fc..ecfe02bdc49f 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/changeSignature/addFunctionParameterForTypeMismatch5.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/changeSignature/addFunctionParameterForTypeMismatch5.kt @@ -1,14 +1,14 @@ // "Add 1st parameter to function 'foo'" "false" // ACTION: Change parameter 'i1' type of function 'foo' to 'String' // ACTION: Convert to 'buildString' call +// ACTION: Convert to raw string literal // ACTION: Create function 'foo' // ACTION: Do not show hints for current method // ACTION: Put arguments on separate lines -// ACTION: To raw string literal // DISABLE-ERRORS fun foo(i1: Int, i2: Int, i3: Int, i4: Int) { } fun test() { foo("", "", 3, 4, 5) -} \ No newline at end of file +} diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createClass/callExpression/callWithExtraArgs.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createClass/callExpression/callWithExtraArgs.kt index b2e5eb860c16..6f662e2df48e 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createClass/callExpression/callWithExtraArgs.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createClass/callExpression/callWithExtraArgs.kt @@ -1,15 +1,15 @@ // "Create class 'Foo'" "false" -// ACTION: Create function 'Foo' // ACTION: Add parameter to constructor 'Foo' // ACTION: Convert to 'buildString' call +// ACTION: Convert to raw string literal +// ACTION: Create function 'Foo' // ACTION: Create secondary constructor -// ERROR: Too many arguments for public constructor Foo(a: Int) defined in Foo // ACTION: Put arguments on separate lines // ACTION: Remove argument -// ACTION: To raw string literal +// ERROR: Too many arguments for public constructor Foo(a: Int) defined in Foo class Foo(a: Int) fun test() { val a = Foo(2, "2") -} \ No newline at end of file +} diff --git a/plugins/kotlin/idea/tests/testData/quickfix/suppress/external/suppressActive.kt b/plugins/kotlin/idea/tests/testData/quickfix/suppress/external/suppressActive.kt index a660a0fa1581..b2454fbb0083 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/suppress/external/suppressActive.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/suppress/external/suppressActive.kt @@ -3,9 +3,9 @@ // ACTION: Convert property initializer to getter // ACTION: Convert to 'buildString' call // ACTION: Convert to lazy property -// ACTION: To raw string literal +// ACTION: Convert to raw string literal @Suppress("SpellCheckingInspection") val str = "kjsghkjshtiurhuig" -// IGNORE_FIR \ No newline at end of file +// IGNORE_FIR diff --git a/plugins/kotlin/idea/tests/testData/quickfix/suppress/redundant/Suppressed.kt b/plugins/kotlin/idea/tests/testData/quickfix/suppress/redundant/Suppressed.kt index 9661fa0b0085..012be73f2d25 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/suppress/redundant/Suppressed.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/suppress/redundant/Suppressed.kt @@ -1,8 +1,8 @@ // "Remove suppression" "false" +// ACTION: Convert to raw string literal // ACTION: Do not show hints for current method // ACTION: Specify type explicitly // ACTION: Split property declaration -// ACTION: To raw string literal fun a(i: Int) { @Suppress("MoveVariableDeclarationIntoWhen") val suppressed = 4 diff --git a/plugins/kotlin/idea/tests/testData/quickfix/tooLongCharLiteralToString/startWithBackslashInString.kt b/plugins/kotlin/idea/tests/testData/quickfix/tooLongCharLiteralToString/startWithBackslashInString.kt index b581d94ab65f..f8ad39c562f7 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/tooLongCharLiteralToString/startWithBackslashInString.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/tooLongCharLiteralToString/startWithBackslashInString.kt @@ -1,10 +1,10 @@ // "Convert too long character literal to string" "false" // ACTION: Compiler warning 'UNUSED_EXPRESSION' options // ACTION: Convert to 'buildString' call +// ACTION: Convert to raw string literal // ACTION: Introduce local variable -// ACTION: To raw string literal // ERROR: Illegal escape: '\ ' fun foo() { "\ " -} \ No newline at end of file +} diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/addArrayOfTypeForJavaAnnotation.before.Main.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/addArrayOfTypeForJavaAnnotation.before.Main.kt index 38c2b61e2eb1..c39de36801d4 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/addArrayOfTypeForJavaAnnotation.before.Main.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/addArrayOfTypeForJavaAnnotation.before.Main.kt @@ -1,8 +1,8 @@ // "class org.jetbrains.kotlin.idea.quickfix.AddArrayOfTypeFix" "false" +// ACTION: Add names in comment to call arguments +// ACTION: Convert to raw string literal // ACTION: Create test // ACTION: Make internal // ACTION: Make private -// ACTION: To raw string literal -// ACTION: Add names in comment to call arguments -@ArrAnn("123") class My \ No newline at end of file +@ArrAnn("123") class My diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/incompatibleTypes/char2.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/incompatibleTypes/char2.kt index 348f2e1579ee..626db92e4950 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/incompatibleTypes/char2.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/incompatibleTypes/char2.kt @@ -1,7 +1,7 @@ // "Convert string to character literal" "false" // ACTION: Convert to 'buildString' call +// ACTION: Convert to raw string literal // ACTION: Enable a trailing comma by default in the formatter -// ACTION: To raw string literal // ERROR: Incompatible types: String and Char fun test(c: Char) { when (c) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/letStringImplementInterface.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/letStringImplementInterface.kt index c48b604fcc30..3aabc5c01f1a 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/letStringImplementInterface.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/letStringImplementInterface.kt @@ -1,7 +1,7 @@ // "Let 'String' implement interface 'A'" "false" // ACTION: Change parameter 'a' type of function 'foo' to 'String' // ACTION: Convert to 'buildString' call -// ACTION: To raw string literal +// ACTION: Convert to raw string literal // ACTION: Create function 'foo' // ERROR: Type mismatch: inferred type is String but A was expected @@ -15,4 +15,4 @@ fun bar() { fun foo(a: A) { } -interface A \ No newline at end of file +interface A diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/parameterTypeMismatch/changeFunctionParameterType4.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/parameterTypeMismatch/changeFunctionParameterType4.kt index 9d38be6d1422..5d04df93901c 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/parameterTypeMismatch/changeFunctionParameterType4.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/parameterTypeMismatch/changeFunctionParameterType4.kt @@ -1,12 +1,12 @@ // "Change parameter 'z' type of function 'foo' to '(Int) -> String'" "false" // ACTION: Convert to 'buildString' call +// ACTION: Convert to raw string literal // ACTION: Do not show return expression hints // ACTION: Introduce local variable -// ACTION: To raw string literal fun foo(y: Int = 0, z: (Int) -> String = {""}) { foo { "" as Int "" } -} \ No newline at end of file +} diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/variableInitializedWithNull2.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/variableInitializedWithNull2.kt index 45df3ec1cd34..0dc24ba0be4c 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/variableInitializedWithNull2.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/variableInitializedWithNull2.kt @@ -1,8 +1,8 @@ // "Change type of 'x' to 'String?'" "false" // ACTION: Convert to 'buildString' call +// ACTION: Convert to raw string literal // ACTION: Converts the assignment statement to an expression // ACTION: Remove braces from 'if' statement -// ACTION: To raw string literal // ERROR: Type mismatch: inferred type is String but Nothing? was expected // ERROR: Val cannot be reassigned fun foo(condition: Boolean) { @@ -10,4 +10,4 @@ fun foo(condition: Boolean) { if (condition) { x = "abc" } -} \ No newline at end of file +} diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/variableInitializedWithNull3.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/variableInitializedWithNull3.kt index 091fbc411b4e..0cacac8305f6 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/variableInitializedWithNull3.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/variableInitializedWithNull3.kt @@ -1,12 +1,12 @@ // "Change type of 'x' to 'String?'" "false" // ACTION: Convert to 'buildString' call +// ACTION: Convert to raw string literal // ACTION: Converts the assignment statement to an expression // ACTION: Remove braces from 'if' statement -// ACTION: To raw string literal // ERROR: Type mismatch: inferred type is String but Int? was expected fun foo(condition: Boolean) { var x: Int? = null if (condition) { x = "abc" } -} \ No newline at end of file +} diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/variableInitializedWithNull4.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/variableInitializedWithNull4.kt index a45526467010..85dddd196657 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/variableInitializedWithNull4.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/variableInitializedWithNull4.kt @@ -1,12 +1,12 @@ // "Change type of 'x' to 'String?'" "false" // ACTION: Convert to 'buildString' call +// ACTION: Convert to raw string literal // ACTION: Converts the assignment statement to an expression // ACTION: Remove braces from 'if' statement -// ACTION: To raw string literal // ERROR: Type mismatch: inferred type is String but Int was expected fun foo(condition: Boolean) { var x = 1 if (condition) { x = "abc" } -} \ No newline at end of file +} diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/wrapWithCollectionLiteral/inAnnotation.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/wrapWithCollectionLiteral/inAnnotation.kt index 2df2e9b3b7bd..9233b53bb6b2 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/wrapWithCollectionLiteral/inAnnotation.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/wrapWithCollectionLiteral/inAnnotation.kt @@ -2,14 +2,14 @@ // ERROR: Type mismatch: inferred type is String but Array was expected // ACTION: Add arrayOf wrapper // ACTION: Change parameter 'value' type of primary constructor of class 'Foo' to 'String' +// ACTION: Convert to raw string literal // ACTION: Create test // ACTION: Extract 'Bar' from current file // ACTION: Make internal // ACTION: Make private -// ACTION: To raw string literal // ACTION: Wrap with [] annotation class Foo(val value: Array) @Foo(value = "abc") -class Bar \ No newline at end of file +class Bar