diff --git a/plugins/kotlin/code-insight/descriptions/resources-en/intentionDescriptions/IndentRawStringIntention/after.kt.template b/plugins/kotlin/code-insight/intentions-shared/resources-en/intentionDescriptions/IndentRawStringIntention/after.kt.template similarity index 100% rename from plugins/kotlin/code-insight/descriptions/resources-en/intentionDescriptions/IndentRawStringIntention/after.kt.template rename to plugins/kotlin/code-insight/intentions-shared/resources-en/intentionDescriptions/IndentRawStringIntention/after.kt.template diff --git a/plugins/kotlin/code-insight/descriptions/resources-en/intentionDescriptions/IndentRawStringIntention/before.kt.template b/plugins/kotlin/code-insight/intentions-shared/resources-en/intentionDescriptions/IndentRawStringIntention/before.kt.template similarity index 100% rename from plugins/kotlin/code-insight/descriptions/resources-en/intentionDescriptions/IndentRawStringIntention/before.kt.template rename to plugins/kotlin/code-insight/intentions-shared/resources-en/intentionDescriptions/IndentRawStringIntention/before.kt.template diff --git a/plugins/kotlin/code-insight/descriptions/resources-en/intentionDescriptions/IndentRawStringIntention/description.html b/plugins/kotlin/code-insight/intentions-shared/resources-en/intentionDescriptions/IndentRawStringIntention/description.html similarity index 100% rename from plugins/kotlin/code-insight/descriptions/resources-en/intentionDescriptions/IndentRawStringIntention/description.html rename to plugins/kotlin/code-insight/intentions-shared/resources-en/intentionDescriptions/IndentRawStringIntention/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 b9d8e048e361..0ab8c37b38ba 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 @@ -189,5 +189,11 @@ group.names.kotlin + + kotlin + org.jetbrains.kotlin.idea.codeInsight.intentions.shared.IndentRawStringIntention + messages.KotlinBundle + group.names.kotlin + \ No newline at end of file diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/IndentRawStringIntention.kt b/plugins/kotlin/code-insight/intentions-shared/src/org/jetbrains/kotlin/idea/codeInsight/intentions/shared/IndentRawStringIntention.kt similarity index 88% rename from plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/IndentRawStringIntention.kt rename to plugins/kotlin/code-insight/intentions-shared/src/org/jetbrains/kotlin/idea/codeInsight/intentions/shared/IndentRawStringIntention.kt index eb454bedb4aa..0b602d1d085f 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/IndentRawStringIntention.kt +++ b/plugins/kotlin/code-insight/intentions-shared/src/org/jetbrains/kotlin/idea/codeInsight/intentions/shared/IndentRawStringIntention.kt @@ -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-2023 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.application.options.CodeStyle import com.intellij.openapi.editor.Editor @@ -16,11 +16,13 @@ import org.jetbrains.kotlin.psi.psiUtil.getQualifiedExpressionForReceiver import org.jetbrains.kotlin.psi.psiUtil.parents import org.jetbrains.kotlin.psi.psiUtil.startOffset +private const val QTS = "\"\"\"" + class IndentRawStringIntention : SelfTargetingOffsetIndependentIntention( KtStringTemplateExpression::class.java, KotlinBundle.lazyMessage("indent.raw.string") ) { override fun isApplicableTo(element: KtStringTemplateExpression): Boolean { - if (!element.text.startsWith("\"\"\"")) return false + if (!element.text.startsWith(QTS)) return false if (element.parents.any { it is KtAnnotationEntry || (it as? KtProperty)?.hasModifier(KtTokens.CONST_KEYWORD) == true }) return false if (element.getQualifiedExpressionForReceiver() != null) return false val entries = element.entries @@ -44,7 +46,6 @@ class IndentRawStringIntention : SelfTargetingOffsetIndependentIntentiongroup.names.kotlin - - kotlin - org.jetbrains.kotlin.idea.intentions.IndentRawStringIntention - messages.KotlinBundle - group.names.kotlin - - kotlin org.jetbrains.kotlin.idea.intentions.ConvertVarargParameterToArrayIntention