Move lambda outside parentheses: fix inspection text / formatting
This commit is contained in:
+2
-4
@@ -15,9 +15,7 @@ import org.jetbrains.kotlin.psi.*
|
|||||||
import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
|
import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
|
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
|
||||||
|
|
||||||
class MoveLambdaOutsideParenthesesInspection : AbstractApplicabilityBasedInspection<KtCallExpression>(
|
class MoveLambdaOutsideParenthesesInspection : AbstractApplicabilityBasedInspection<KtCallExpression>(KtCallExpression::class.java) {
|
||||||
KtCallExpression::class.java
|
|
||||||
) {
|
|
||||||
override fun isApplicable(element: KtCallExpression) = element.canMoveLambdaOutsideParentheses()
|
override fun isApplicable(element: KtCallExpression) = element.canMoveLambdaOutsideParentheses()
|
||||||
|
|
||||||
override fun applyTo(element: PsiElement, project: Project, editor: Editor?) {
|
override fun applyTo(element: PsiElement, project: Project, editor: Editor?) {
|
||||||
@@ -28,7 +26,7 @@ class MoveLambdaOutsideParenthesesInspection : AbstractApplicabilityBasedInspect
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun inspectionText(element: KtCallExpression) = "Should be moved lambda argument out of parentheses"
|
override fun inspectionText(element: KtCallExpression) = "Lambda argument should be moved out of parentheses"
|
||||||
|
|
||||||
override fun inspectionTarget(element: KtCallExpression): KtElement {
|
override fun inspectionTarget(element: KtCallExpression): KtElement {
|
||||||
return element.getLastLambdaExpression()?.getStrictParentOfType<KtValueArgument>()?.asElement() ?: element
|
return element.getLastLambdaExpression()?.getStrictParentOfType<KtValueArgument>()?.asElement() ?: element
|
||||||
|
|||||||
Reference in New Issue
Block a user