Reduce range of IfThenTo... inspections to just 'if'
This commit is contained in:
+3
-1
@@ -33,7 +33,9 @@ import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
|||||||
class IfThenToElvisInspection : IntentionBasedInspection<KtIfExpression>(
|
class IfThenToElvisInspection : IntentionBasedInspection<KtIfExpression>(
|
||||||
IfThenToElvisIntention::class,
|
IfThenToElvisIntention::class,
|
||||||
{ it -> it.isUsedAsExpression(it.analyze(BodyResolveMode.PARTIAL)) }
|
{ it -> it.isUsedAsExpression(it.analyze(BodyResolveMode.PARTIAL)) }
|
||||||
)
|
) {
|
||||||
|
override fun inspectionTarget(element: KtIfExpression) = element.ifKeyword
|
||||||
|
}
|
||||||
|
|
||||||
class IfThenToElvisIntention : SelfTargetingOffsetIndependentIntention<KtIfExpression>(
|
class IfThenToElvisIntention : SelfTargetingOffsetIndependentIntention<KtIfExpression>(
|
||||||
KtIfExpression::class.java,
|
KtIfExpression::class.java,
|
||||||
|
|||||||
+4
-1
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
||||||
|
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
|
import com.intellij.psi.PsiElement
|
||||||
import org.jetbrains.kotlin.idea.core.replaced
|
import org.jetbrains.kotlin.idea.core.replaced
|
||||||
import org.jetbrains.kotlin.idea.inspections.IntentionBasedInspection
|
import org.jetbrains.kotlin.idea.inspections.IntentionBasedInspection
|
||||||
import org.jetbrains.kotlin.idea.intentions.SelfTargetingOffsetIndependentIntention
|
import org.jetbrains.kotlin.idea.intentions.SelfTargetingOffsetIndependentIntention
|
||||||
@@ -24,7 +25,9 @@ import org.jetbrains.kotlin.idea.intentions.branchedTransformations.*
|
|||||||
import org.jetbrains.kotlin.idea.util.application.runWriteAction
|
import org.jetbrains.kotlin.idea.util.application.runWriteAction
|
||||||
import org.jetbrains.kotlin.psi.*
|
import org.jetbrains.kotlin.psi.*
|
||||||
|
|
||||||
class IfThenToSafeAccessInspection : IntentionBasedInspection<KtIfExpression>(IfThenToSafeAccessIntention::class)
|
class IfThenToSafeAccessInspection : IntentionBasedInspection<KtIfExpression>(IfThenToSafeAccessIntention::class) {
|
||||||
|
override fun inspectionTarget(element: KtIfExpression) = element.ifKeyword
|
||||||
|
}
|
||||||
|
|
||||||
class IfThenToSafeAccessIntention : SelfTargetingOffsetIndependentIntention<KtIfExpression>(
|
class IfThenToSafeAccessIntention : SelfTargetingOffsetIndependentIntention<KtIfExpression>(
|
||||||
KtIfExpression::class.java, "Replace 'if' expression with safe access expression"
|
KtIfExpression::class.java, "Replace 'if' expression with safe access expression"
|
||||||
|
|||||||
Reference in New Issue
Block a user