KT-21811 Convert string concatenation into multiline string (#2772)
New J2K: Convert string concatenation into multiline string #KT-21811 Fixed
This commit is contained in:
committed by
Ilya Kirillov
parent
c14affd6cd
commit
3a576ce14f
@@ -64,7 +64,7 @@ open class ConvertToStringTemplateIntention : SelfTargetingOffsetIndependentInte
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
protected fun buildReplacement(expression: KtBinaryExpression): KtStringTemplateExpression {
|
||||
fun buildReplacement(expression: KtBinaryExpression): KtStringTemplateExpression {
|
||||
val rightText = buildText(expression.right, false)
|
||||
return fold(expression.left, rightText, KtPsiFactory(expression))
|
||||
}
|
||||
|
||||
@@ -17,11 +17,11 @@ import org.jetbrains.kotlin.psi.psiUtil.getQualifiedExpressionForReceiver
|
||||
import org.jetbrains.kotlin.psi.psiUtil.parents
|
||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||
|
||||
class IndentRawStringIntention : SelfTargetingIntention<KtStringTemplateExpression>(
|
||||
class IndentRawStringIntention : SelfTargetingOffsetIndependentIntention<KtStringTemplateExpression>(
|
||||
KtStringTemplateExpression::class.java, "Indent raw string"
|
||||
) {
|
||||
|
||||
override fun isApplicableTo(element: KtStringTemplateExpression, caretOffset: Int): Boolean {
|
||||
override fun isApplicableTo(element: KtStringTemplateExpression): Boolean {
|
||||
if (!element.text.startsWith("\"\"\"")) 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
|
||||
|
||||
Reference in New Issue
Block a user