Propose convert to string template as inspection more frequent

This commit is contained in:
Simon Ogorodnik
2018-02-22 15:10:47 +03:00
committed by Stanislav Erokhin
parent 4c15642e2c
commit 57e47d1830
11 changed files with 60 additions and 30 deletions
@@ -51,9 +51,9 @@ open class ConvertToStringTemplateIntention : SelfTargetingOffsetIndependentInte
fun shouldSuggestToConvert(expression: KtBinaryExpression): Boolean {
val entries = buildReplacement(expression).entries
return entries.none { it is KtBlockStringTemplateEntry }
&& !entries.all { it is KtLiteralStringTemplateEntry || it is KtEscapeStringTemplateEntry }
&& entries.count { it is KtLiteralStringTemplateEntry } > 1
&& !expression.textContains('\n')
&& !entries.all { it is KtLiteralStringTemplateEntry || it is KtEscapeStringTemplateEntry }
&& entries.count { it is KtLiteralStringTemplateEntry } >= 1
&& !expression.textContains('\n')
}
@JvmStatic