Do not reformat expressions in ReplaceCallWithBinaryOperatorInspection and SpecifySuperTypeFix
This commit is contained in:
+3
-3
@@ -141,16 +141,16 @@ class ReplaceCallWithBinaryOperatorInspection : AbstractApplicabilityBasedInspec
|
|||||||
return when (operation) {
|
return when (operation) {
|
||||||
KtTokens.EXCLEQ -> {
|
KtTokens.EXCLEQ -> {
|
||||||
val prefixExpression = element.getWrappingPrefixExpressionIfAny() ?: return null
|
val prefixExpression = element.getWrappingPrefixExpressionIfAny() ?: return null
|
||||||
val newExpression = factory.createExpressionByPattern("$0 != $1", receiver, argument)
|
val newExpression = factory.createExpressionByPattern("$0 != $1", receiver, argument, reformat = false)
|
||||||
prefixExpression to newExpression
|
prefixExpression to newExpression
|
||||||
}
|
}
|
||||||
in OperatorConventions.COMPARISON_OPERATIONS -> {
|
in OperatorConventions.COMPARISON_OPERATIONS -> {
|
||||||
val binaryParent = element.parent as? KtBinaryExpression ?: return null
|
val binaryParent = element.parent as? KtBinaryExpression ?: return null
|
||||||
val newExpression = factory.createExpressionByPattern("$0 ${operation.value} $1", receiver, argument)
|
val newExpression = factory.createExpressionByPattern("$0 ${operation.value} $1", receiver, argument, reformat = false)
|
||||||
binaryParent to newExpression
|
binaryParent to newExpression
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
val newExpression = factory.createExpressionByPattern("$0 ${operation.value} $1", receiver, argument)
|
val newExpression = factory.createExpressionByPattern("$0 ${operation.value} $1", receiver, argument, reformat = false)
|
||||||
element to newExpression
|
element to newExpression
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class SpecifySuperTypeFix(
|
|||||||
val fqName = kotlinType.fqName ?: return@mapNotNull null
|
val fqName = kotlinType.fqName ?: return@mapNotNull null
|
||||||
val fqNameAsString = fqName.asString()
|
val fqNameAsString = fqName.asString()
|
||||||
val name = if (typeElement.text.startsWith(fqNameAsString)) fqNameAsString else fqName.shortName().asString()
|
val name = if (typeElement.text.startsWith(fqNameAsString)) fqNameAsString else fqName.shortName().asString()
|
||||||
val newQualifiedExpression = psiFactory.createExpressionByPattern("super<$name>.$0", selectorExpression)
|
val newQualifiedExpression = psiFactory.createExpressionByPattern("super<$name>.$0", selectorExpression, reformat = false)
|
||||||
val newContext = newQualifiedExpression.analyzeAsReplacement(qualifiedExpression, context)
|
val newContext = newQualifiedExpression.analyzeAsReplacement(qualifiedExpression, context)
|
||||||
if (newQualifiedExpression.getResolvedCall(newContext)?.resultingDescriptor == null) return@mapNotNull null
|
if (newQualifiedExpression.getResolvedCall(newContext)?.resultingDescriptor == null) return@mapNotNull null
|
||||||
if (newContext.diagnostics.noSuppression().forElement(newQualifiedExpression).isNotEmpty()) return@mapNotNull null
|
if (newContext.diagnostics.noSuppression().forElement(newQualifiedExpression).isNotEmpty()) return@mapNotNull null
|
||||||
|
|||||||
Reference in New Issue
Block a user