Minor: Get rid of the hard-coded modifier value
This commit is contained in:
+2
-1
@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.idea.KotlinBundle
|
|||||||
import org.jetbrains.kotlin.idea.core.util.range
|
import org.jetbrains.kotlin.idea.core.util.range
|
||||||
import org.jetbrains.kotlin.idea.inspections.IntentionBasedInspection
|
import org.jetbrains.kotlin.idea.inspections.IntentionBasedInspection
|
||||||
import org.jetbrains.kotlin.idea.refactoring.getLineNumber
|
import org.jetbrains.kotlin.idea.refactoring.getLineNumber
|
||||||
|
import org.jetbrains.kotlin.lexer.KtTokens
|
||||||
import org.jetbrains.kotlin.psi.KtCallExpression
|
import org.jetbrains.kotlin.psi.KtCallExpression
|
||||||
import org.jetbrains.kotlin.psi.KtQualifiedExpression
|
import org.jetbrains.kotlin.psi.KtQualifiedExpression
|
||||||
import org.jetbrains.kotlin.psi.KtValueArgumentList
|
import org.jetbrains.kotlin.psi.KtValueArgumentList
|
||||||
@@ -31,7 +32,7 @@ class RemoveEmptyParenthesesFromLambdaCallIntention : SelfTargetingRangeIntentio
|
|||||||
override fun applicabilityRange(element: KtValueArgumentList): TextRange? {
|
override fun applicabilityRange(element: KtValueArgumentList): TextRange? {
|
||||||
if (element.arguments.isNotEmpty()) return null
|
if (element.arguments.isNotEmpty()) return null
|
||||||
val parent = element.parent as? KtCallExpression ?: return null
|
val parent = element.parent as? KtCallExpression ?: return null
|
||||||
if (parent.calleeExpression?.text == "suspend") return null
|
if (parent.calleeExpression?.text == KtTokens.SUSPEND_KEYWORD.value) return null
|
||||||
val singleLambdaArgument = parent.lambdaArguments.singleOrNull() ?: return null
|
val singleLambdaArgument = parent.lambdaArguments.singleOrNull() ?: return null
|
||||||
if (element.getLineNumber(start = false) != singleLambdaArgument.getLineNumber(start = true)) return null
|
if (element.getLineNumber(start = false) != singleLambdaArgument.getLineNumber(start = true)) return null
|
||||||
val prev = element.getPrevSiblingIgnoringWhitespaceAndComments()
|
val prev = element.getPrevSiblingIgnoringWhitespaceAndComments()
|
||||||
|
|||||||
Reference in New Issue
Block a user