Made all inspections making code more verbose low priority
This commit is contained in:
+3
-2
@@ -16,16 +16,17 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.intentions
|
package org.jetbrains.kotlin.idea.intentions
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||||
|
import org.jetbrains.kotlin.idea.core.replaced
|
||||||
import org.jetbrains.kotlin.idea.util.ShortenReferences
|
import org.jetbrains.kotlin.idea.util.ShortenReferences
|
||||||
import org.jetbrains.kotlin.psi.*
|
import org.jetbrains.kotlin.psi.*
|
||||||
import org.jetbrains.kotlin.idea.core.replaced
|
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
||||||
|
|
||||||
public class ConvertAssertToIfWithThrowIntention : JetSelfTargetingIntention<JetCallExpression>(javaClass(), "Replace 'assert' with 'if' statement") {
|
public class ConvertAssertToIfWithThrowIntention : JetSelfTargetingIntention<JetCallExpression>(javaClass(), "Replace 'assert' with 'if' statement"), LowPriorityAction {
|
||||||
override fun isApplicableTo(element: JetCallExpression, caretOffset: Int): Boolean {
|
override fun isApplicableTo(element: JetCallExpression, caretOffset: Int): Boolean {
|
||||||
val callee = element.getCalleeExpression() ?: return false
|
val callee = element.getCalleeExpression() ?: return false
|
||||||
if (!callee.getTextRange().containsOffset(caretOffset)) return false
|
if (!callee.getTextRange().containsOffset(caretOffset)) return false
|
||||||
|
|||||||
+2
-1
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.intentions
|
package org.jetbrains.kotlin.idea.intentions
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||||
@@ -27,7 +28,7 @@ import org.jetbrains.kotlin.psi.JetNamedFunction
|
|||||||
import org.jetbrains.kotlin.psi.JetTypeReference
|
import org.jetbrains.kotlin.psi.JetTypeReference
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
import org.jetbrains.kotlin.resolve.BindingContext
|
||||||
|
|
||||||
public class ConvertReceiverToParameterIntention : JetSelfTargetingOffsetIndependentIntention<JetTypeReference>(javaClass(), "Convert receiver to parameter") {
|
public class ConvertReceiverToParameterIntention : JetSelfTargetingOffsetIndependentIntention<JetTypeReference>(javaClass(), "Convert receiver to parameter"), LowPriorityAction {
|
||||||
override fun isApplicableTo(element: JetTypeReference): Boolean {
|
override fun isApplicableTo(element: JetTypeReference): Boolean {
|
||||||
return (element.getParent() as? JetNamedFunction)?.getReceiverTypeReference() == element
|
return (element.getParent() as? JetNamedFunction)?.getReceiverTypeReference() == element
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.intentions
|
package org.jetbrains.kotlin.idea.intentions
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||||
@@ -23,7 +24,7 @@ import org.jetbrains.kotlin.lexer.JetTokens
|
|||||||
import org.jetbrains.kotlin.psi.*
|
import org.jetbrains.kotlin.psi.*
|
||||||
import org.jetbrains.kotlin.resolve.BindingContextUtils
|
import org.jetbrains.kotlin.resolve.BindingContextUtils
|
||||||
|
|
||||||
public class ConvertToConcatenatedStringIntention : JetSelfTargetingOffsetIndependentIntention<JetStringTemplateExpression>(javaClass(), "Convert template to concatenated string") {
|
public class ConvertToConcatenatedStringIntention : JetSelfTargetingOffsetIndependentIntention<JetStringTemplateExpression>(javaClass(), "Convert template to concatenated string"), LowPriorityAction {
|
||||||
override fun isApplicableTo(element: JetStringTemplateExpression): Boolean {
|
override fun isApplicableTo(element: JetStringTemplateExpression): Boolean {
|
||||||
if (element.getLastChild().getNode().getElementType() != JetTokens.CLOSING_QUOTE) return false // not available for unclosed literal
|
if (element.getLastChild().getNode().getElementType() != JetTokens.CLOSING_QUOTE) return false // not available for unclosed literal
|
||||||
return element.getEntries().any { it is JetStringTemplateEntryWithExpression }
|
return element.getEntries().any { it is JetStringTemplateEntryWithExpression }
|
||||||
|
|||||||
+4
-3
@@ -16,12 +16,13 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.intentions
|
package org.jetbrains.kotlin.idea.intentions
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import org.jetbrains.kotlin.psi.JetSimpleNameStringTemplateEntry
|
|
||||||
import org.jetbrains.kotlin.psi.JetPsiFactory
|
import org.jetbrains.kotlin.psi.JetPsiFactory
|
||||||
|
import org.jetbrains.kotlin.psi.JetSimpleNameStringTemplateEntry
|
||||||
|
|
||||||
public class InsertCurlyBracesToTemplateIntention : JetSelfTargetingOffsetIndependentIntention<JetSimpleNameStringTemplateEntry>(
|
public class InsertCurlyBracesToTemplateIntention : JetSelfTargetingOffsetIndependentIntention<JetSimpleNameStringTemplateEntry> (
|
||||||
javaClass(), "Insert curly braces around variable") {
|
javaClass(), "Insert curly braces around variable"), LowPriorityAction {
|
||||||
|
|
||||||
override fun isApplicableTo(element: JetSimpleNameStringTemplateEntry): Boolean = true
|
override fun isApplicableTo(element: JetSimpleNameStringTemplateEntry): Boolean = true
|
||||||
|
|
||||||
|
|||||||
@@ -16,19 +16,18 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.intentions
|
package org.jetbrains.kotlin.idea.intentions
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.psi.util.PsiTreeUtil
|
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||||
|
import org.jetbrains.kotlin.idea.core.replaced
|
||||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers
|
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers
|
||||||
import org.jetbrains.kotlin.idea.util.ShortenReferences
|
import org.jetbrains.kotlin.idea.util.ShortenReferences
|
||||||
import org.jetbrains.kotlin.psi.*
|
import org.jetbrains.kotlin.psi.*
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
|
import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
|
||||||
import org.jetbrains.kotlin.idea.core.replaced
|
|
||||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer
|
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
import org.jetbrains.kotlin.resolve.BindingContext
|
||||||
import org.jetbrains.kotlin.types.JetType
|
import org.jetbrains.kotlin.types.JetType
|
||||||
|
|
||||||
public class ReconstructTypeInCastOrIsIntention : JetSelfTargetingOffsetIndependentIntention<JetTypeReference>(javaClass(), "Replace by reconstructed type") {
|
public class ReconstructTypeInCastOrIsIntention : JetSelfTargetingOffsetIndependentIntention<JetTypeReference>(javaClass(), "Replace by reconstructed type"), LowPriorityAction {
|
||||||
override fun isApplicableTo(element: JetTypeReference): Boolean {
|
override fun isApplicableTo(element: JetTypeReference): Boolean {
|
||||||
// Only user types (like Foo) are interesting
|
// Only user types (like Foo) are interesting
|
||||||
val typeElement = element.getTypeElement() as? JetUserType ?: return false
|
val typeElement = element.getTypeElement() as? JetUserType ?: return false
|
||||||
|
|||||||
+3
-10
@@ -16,28 +16,21 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.intentions
|
package org.jetbrains.kotlin.idea.intentions
|
||||||
|
|
||||||
import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction
|
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.project.Project
|
|
||||||
import com.intellij.psi.PsiDocumentManager
|
import com.intellij.psi.PsiDocumentManager
|
||||||
import com.intellij.psi.PsiElement
|
|
||||||
import com.intellij.refactoring.rename.inplace.VariableInplaceRenameHandler
|
import com.intellij.refactoring.rename.inplace.VariableInplaceRenameHandler
|
||||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
|
||||||
import org.jetbrains.kotlin.idea.JetBundle
|
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||||
import org.jetbrains.kotlin.idea.references.JetReference
|
import org.jetbrains.kotlin.idea.references.JetReference
|
||||||
import org.jetbrains.kotlin.psi.JetFunctionLiteral
|
import org.jetbrains.kotlin.psi.JetFunctionLiteral
|
||||||
import org.jetbrains.kotlin.psi.JetFunctionLiteralExpression
|
import org.jetbrains.kotlin.psi.JetFunctionLiteralExpression
|
||||||
import org.jetbrains.kotlin.psi.JetPsiFactory
|
import org.jetbrains.kotlin.psi.JetPsiFactory
|
||||||
import org.jetbrains.kotlin.psi.JetSimpleNameExpression
|
import org.jetbrains.kotlin.psi.JetSimpleNameExpression
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
|
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
||||||
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
|
||||||
|
|
||||||
public class ReplaceItWithExplicitFunctionLiteralParamIntention() : JetSelfTargetingOffsetIndependentIntention<JetSimpleNameExpression>(
|
public class ReplaceItWithExplicitFunctionLiteralParamIntention() : JetSelfTargetingOffsetIndependentIntention<JetSimpleNameExpression> (
|
||||||
javaClass(), "Replace 'it' with explicit parameter"
|
javaClass(), "Replace 'it' with explicit parameter"
|
||||||
) {
|
), LowPriorityAction {
|
||||||
override fun isApplicableTo(element: JetSimpleNameExpression)
|
override fun isApplicableTo(element: JetSimpleNameExpression)
|
||||||
= isAutoCreatedItUsage(element)
|
= isAutoCreatedItUsage(element)
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.intentions
|
package org.jetbrains.kotlin.idea.intentions
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import org.jetbrains.kotlin.lexer.JetTokens
|
import org.jetbrains.kotlin.lexer.JetTokens
|
||||||
import org.jetbrains.kotlin.psi.JetBinaryExpression
|
import org.jetbrains.kotlin.psi.JetBinaryExpression
|
||||||
@@ -23,7 +24,7 @@ import org.jetbrains.kotlin.psi.JetPsiFactory
|
|||||||
import org.jetbrains.kotlin.psi.JetSimpleNameExpression
|
import org.jetbrains.kotlin.psi.JetSimpleNameExpression
|
||||||
import org.jetbrains.kotlin.psi.createExpressionByPattern
|
import org.jetbrains.kotlin.psi.createExpressionByPattern
|
||||||
|
|
||||||
public class ReplaceWithOrdinaryAssignmentIntention : JetSelfTargetingIntention<JetBinaryExpression>(javaClass(), "Replace with ordinary assignment") {
|
public class ReplaceWithOrdinaryAssignmentIntention : JetSelfTargetingIntention<JetBinaryExpression>(javaClass(), "Replace with ordinary assignment"), LowPriorityAction {
|
||||||
override fun isApplicableTo(element: JetBinaryExpression, caretOffset: Int): Boolean {
|
override fun isApplicableTo(element: JetBinaryExpression, caretOffset: Int): Boolean {
|
||||||
if (element.getOperationToken() !in JetTokens.AUGMENTED_ASSIGNMENTS) return false
|
if (element.getOperationToken() !in JetTokens.AUGMENTED_ASSIGNMENTS) return false
|
||||||
if (element.getLeft() !is JetSimpleNameExpression) return false
|
if (element.getLeft() !is JetSimpleNameExpression) return false
|
||||||
|
|||||||
+7
-7
@@ -16,18 +16,18 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.intentions
|
package org.jetbrains.kotlin.idea.intentions
|
||||||
|
|
||||||
import org.jetbrains.kotlin.psi.JetFunctionLiteralExpression
|
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
|
||||||
import org.jetbrains.kotlin.types.ErrorUtils
|
|
||||||
import org.jetbrains.kotlin.psi.JetPsiFactory
|
|
||||||
import com.intellij.psi.PsiWhiteSpace
|
import com.intellij.psi.PsiWhiteSpace
|
||||||
import org.jetbrains.kotlin.idea.util.ShortenReferences
|
|
||||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers
|
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||||
|
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers
|
||||||
|
import org.jetbrains.kotlin.idea.util.ShortenReferences
|
||||||
|
import org.jetbrains.kotlin.psi.JetFunctionLiteralExpression
|
||||||
|
import org.jetbrains.kotlin.psi.JetPsiFactory
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
||||||
|
import org.jetbrains.kotlin.resolve.BindingContext
|
||||||
|
|
||||||
public class SpecifyExplicitLambdaSignatureIntention : JetSelfTargetingIntention<JetFunctionLiteralExpression>(javaClass(), "Specify explicit lambda signature") {
|
public class SpecifyExplicitLambdaSignatureIntention : JetSelfTargetingIntention<JetFunctionLiteralExpression>(javaClass(), "Specify explicit lambda signature"), LowPriorityAction {
|
||||||
|
|
||||||
override fun isApplicableTo(element: JetFunctionLiteralExpression, caretOffset: Int): Boolean {
|
override fun isApplicableTo(element: JetFunctionLiteralExpression, caretOffset: Int): Boolean {
|
||||||
val arrow = element.getFunctionLiteral().getArrow()
|
val arrow = element.getFunctionLiteral().getArrow()
|
||||||
|
|||||||
@@ -16,24 +16,16 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.intentions
|
package org.jetbrains.kotlin.idea.intentions
|
||||||
|
|
||||||
import com.google.common.collect.Lists
|
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||||
import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction
|
|
||||||
import com.intellij.codeInsight.template.*
|
import com.intellij.codeInsight.template.*
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.project.Project
|
|
||||||
import com.intellij.psi.PsiDocumentManager
|
import com.intellij.psi.PsiDocumentManager
|
||||||
import com.intellij.psi.PsiElement
|
|
||||||
import com.intellij.psi.util.PsiTreeUtil
|
|
||||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
|
||||||
import org.jetbrains.kotlin.diagnostics.Errors
|
import org.jetbrains.kotlin.diagnostics.Errors
|
||||||
import org.jetbrains.kotlin.idea.JetBundle
|
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeFully
|
|
||||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers
|
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers
|
||||||
import org.jetbrains.kotlin.idea.util.ShortenReferences
|
import org.jetbrains.kotlin.idea.util.ShortenReferences
|
||||||
import org.jetbrains.kotlin.j2k.isConstructor
|
|
||||||
import org.jetbrains.kotlin.psi.*
|
import org.jetbrains.kotlin.psi.*
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.getElementTextWithContext
|
import org.jetbrains.kotlin.psi.psiUtil.getElementTextWithContext
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
import org.jetbrains.kotlin.resolve.BindingContext
|
||||||
@@ -43,7 +35,7 @@ import org.jetbrains.kotlin.types.JetType
|
|||||||
import org.jetbrains.kotlin.types.TypeUtils
|
import org.jetbrains.kotlin.types.TypeUtils
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
|
|
||||||
public class SpecifyTypeExplicitlyIntention : JetSelfTargetingIntention<JetCallableDeclaration>(javaClass(), "Specify type explicitly") {
|
public class SpecifyTypeExplicitlyIntention : JetSelfTargetingIntention<JetCallableDeclaration>(javaClass(), "Specify type explicitly"), LowPriorityAction {
|
||||||
override fun isApplicableTo(element: JetCallableDeclaration, caretOffset: Int): Boolean {
|
override fun isApplicableTo(element: JetCallableDeclaration, caretOffset: Int): Boolean {
|
||||||
if (element.getContainingFile() is JetCodeFragment) return false
|
if (element.getContainingFile() is JetCodeFragment) return false
|
||||||
if (element is JetFunctionLiteral) return false // TODO: should JetFunctionLiteral be JetCallableDeclaration at all?
|
if (element is JetFunctionLiteral) return false // TODO: should JetFunctionLiteral be JetCallableDeclaration at all?
|
||||||
|
|||||||
+6
-2
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||||
import com.intellij.codeInsight.template.Template
|
import com.intellij.codeInsight.template.Template
|
||||||
import com.intellij.codeInsight.template.TemplateBuilderImpl
|
import com.intellij.codeInsight.template.TemplateBuilderImpl
|
||||||
import com.intellij.codeInsight.template.TemplateEditingAdapter
|
import com.intellij.codeInsight.template.TemplateEditingAdapter
|
||||||
@@ -27,7 +28,10 @@ import org.apache.commons.lang.StringEscapeUtils.escapeJava
|
|||||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||||
import org.jetbrains.kotlin.idea.intentions.JetSelfTargetingRangeIntention
|
import org.jetbrains.kotlin.idea.intentions.JetSelfTargetingRangeIntention
|
||||||
import org.jetbrains.kotlin.idea.intentions.JetTypeLookupExpression
|
import org.jetbrains.kotlin.idea.intentions.JetTypeLookupExpression
|
||||||
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.*
|
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.convertToIfNotNullExpression
|
||||||
|
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.convertToIfNullExpression
|
||||||
|
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.introduceValueForCondition
|
||||||
|
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.isStableVariable
|
||||||
import org.jetbrains.kotlin.lexer.JetTokens
|
import org.jetbrains.kotlin.lexer.JetTokens
|
||||||
import org.jetbrains.kotlin.psi.JetPostfixExpression
|
import org.jetbrains.kotlin.psi.JetPostfixExpression
|
||||||
import org.jetbrains.kotlin.psi.JetPsiFactory
|
import org.jetbrains.kotlin.psi.JetPsiFactory
|
||||||
@@ -35,7 +39,7 @@ import org.jetbrains.kotlin.psi.JetPsiUtil
|
|||||||
import org.jetbrains.kotlin.psi.JetThrowExpression
|
import org.jetbrains.kotlin.psi.JetThrowExpression
|
||||||
import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsStatement
|
import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsStatement
|
||||||
|
|
||||||
public class DoubleBangToIfThenIntention : JetSelfTargetingRangeIntention<JetPostfixExpression>(javaClass(), "Replace '!!' expression with 'if' expression") {
|
public class DoubleBangToIfThenIntention : JetSelfTargetingRangeIntention<JetPostfixExpression>(javaClass(), "Replace '!!' expression with 'if' expression"), LowPriorityAction {
|
||||||
override fun applicabilityRange(element: JetPostfixExpression): TextRange? {
|
override fun applicabilityRange(element: JetPostfixExpression): TextRange? {
|
||||||
return if (element.getOperationToken() == JetTokens.EXCLEXCL && element.getBaseExpression() != null)
|
return if (element.getOperationToken() == JetTokens.EXCLEXCL && element.getBaseExpression() != null)
|
||||||
element.getOperationReference().getTextRange()
|
element.getOperationReference().getTextRange()
|
||||||
|
|||||||
+2
-1
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import org.jetbrains.kotlin.idea.intentions.JetSelfTargetingIntention
|
import org.jetbrains.kotlin.idea.intentions.JetSelfTargetingIntention
|
||||||
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.toExpression
|
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.toExpression
|
||||||
@@ -25,7 +26,7 @@ import org.jetbrains.kotlin.psi.JetWhenExpression
|
|||||||
import org.jetbrains.kotlin.psi.buildExpression
|
import org.jetbrains.kotlin.psi.buildExpression
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||||
|
|
||||||
public class EliminateWhenSubjectIntention : JetSelfTargetingIntention<JetWhenExpression>(javaClass(), "Eliminate argument of 'when'") {
|
public class EliminateWhenSubjectIntention : JetSelfTargetingIntention<JetWhenExpression>(javaClass(), "Eliminate argument of 'when'"), LowPriorityAction {
|
||||||
override fun isApplicableTo(element: JetWhenExpression, caretOffset: Int): Boolean {
|
override fun isApplicableTo(element: JetWhenExpression, caretOffset: Int): Boolean {
|
||||||
if (element.getSubjectExpression() !is JetSimpleNameExpression) return false
|
if (element.getSubjectExpression() !is JetSimpleNameExpression) return false
|
||||||
val lBrace = element.getOpenBrace() ?: return false
|
val lBrace = element.getOpenBrace() ?: return false
|
||||||
|
|||||||
+2
-1
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.util.TextRange
|
import com.intellij.openapi.util.TextRange
|
||||||
import org.jetbrains.kotlin.idea.intentions.JetSelfTargetingRangeIntention
|
import org.jetbrains.kotlin.idea.intentions.JetSelfTargetingRangeIntention
|
||||||
@@ -26,7 +27,7 @@ import org.jetbrains.kotlin.lexer.JetTokens
|
|||||||
import org.jetbrains.kotlin.psi.JetBinaryExpression
|
import org.jetbrains.kotlin.psi.JetBinaryExpression
|
||||||
import org.jetbrains.kotlin.psi.JetPsiUtil
|
import org.jetbrains.kotlin.psi.JetPsiUtil
|
||||||
|
|
||||||
public class ElvisToIfThenIntention : JetSelfTargetingRangeIntention<JetBinaryExpression>(javaClass(), "Replace elvis expression with 'if' expression") {
|
public class ElvisToIfThenIntention : JetSelfTargetingRangeIntention<JetBinaryExpression>(javaClass(), "Replace elvis expression with 'if' expression"), LowPriorityAction {
|
||||||
override fun applicabilityRange(element: JetBinaryExpression): TextRange? {
|
override fun applicabilityRange(element: JetBinaryExpression): TextRange? {
|
||||||
return if (element.getOperationToken() == JetTokens.ELVIS && element.getLeft() != null && element.getRight() != null)
|
return if (element.getOperationToken() == JetTokens.ELVIS && element.getLeft() != null && element.getRight() != null)
|
||||||
element.getOperationReference().getTextRange()
|
element.getOperationReference().getTextRange()
|
||||||
|
|||||||
+2
-1
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.util.TextRange
|
import com.intellij.openapi.util.TextRange
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||||
@@ -26,7 +27,7 @@ import org.jetbrains.kotlin.idea.intentions.branchedTransformations.isStableVari
|
|||||||
import org.jetbrains.kotlin.psi.*
|
import org.jetbrains.kotlin.psi.*
|
||||||
import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsStatement
|
import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsStatement
|
||||||
|
|
||||||
public class SafeAccessToIfThenIntention : JetSelfTargetingRangeIntention<JetSafeQualifiedExpression>(javaClass(), "Replace safe access expression with 'if' expression") {
|
public class SafeAccessToIfThenIntention : JetSelfTargetingRangeIntention<JetSafeQualifiedExpression>(javaClass(), "Replace safe access expression with 'if' expression"), LowPriorityAction {
|
||||||
override fun applicabilityRange(element: JetSafeQualifiedExpression): TextRange? {
|
override fun applicabilityRange(element: JetSafeQualifiedExpression): TextRange? {
|
||||||
if (element.getSelectorExpression() == null) return null
|
if (element.getSelectorExpression() == null) return null
|
||||||
return element.getOperationTokenNode().getTextRange()
|
return element.getOperationTokenNode().getTextRange()
|
||||||
|
|||||||
+2
-1
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.util.TextRange
|
import com.intellij.openapi.util.TextRange
|
||||||
import org.jetbrains.kotlin.idea.intentions.JetSelfTargetingRangeIntention
|
import org.jetbrains.kotlin.idea.intentions.JetSelfTargetingRangeIntention
|
||||||
@@ -26,7 +27,7 @@ import org.jetbrains.kotlin.psi.JetIfExpression
|
|||||||
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||||
|
|
||||||
public class UnfoldAssignmentToIfIntention : JetSelfTargetingRangeIntention<JetBinaryExpression>(javaClass(), "Replace assignment with 'if' expression") {
|
public class UnfoldAssignmentToIfIntention : JetSelfTargetingRangeIntention<JetBinaryExpression>(javaClass(), "Replace assignment with 'if' expression"), LowPriorityAction {
|
||||||
override fun applicabilityRange(element: JetBinaryExpression): TextRange? {
|
override fun applicabilityRange(element: JetBinaryExpression): TextRange? {
|
||||||
if (element.getOperationToken() !in JetTokens.ALL_ASSIGNMENTS) return null
|
if (element.getOperationToken() !in JetTokens.ALL_ASSIGNMENTS) return null
|
||||||
if (element.getLeft() == null) return null
|
if (element.getLeft() == null) return null
|
||||||
|
|||||||
+2
-1
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.util.TextRange
|
import com.intellij.openapi.util.TextRange
|
||||||
import org.jetbrains.kotlin.idea.intentions.JetSelfTargetingRangeIntention
|
import org.jetbrains.kotlin.idea.intentions.JetSelfTargetingRangeIntention
|
||||||
@@ -27,7 +28,7 @@ import org.jetbrains.kotlin.psi.JetWhenExpression
|
|||||||
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||||
|
|
||||||
public class UnfoldAssignmentToWhenIntention : JetSelfTargetingRangeIntention<JetBinaryExpression>(javaClass(), "Replace assignment with 'when' expression" ) {
|
public class UnfoldAssignmentToWhenIntention : JetSelfTargetingRangeIntention<JetBinaryExpression>(javaClass(), "Replace assignment with 'when' expression" ), LowPriorityAction {
|
||||||
override fun applicabilityRange(element: JetBinaryExpression): TextRange? {
|
override fun applicabilityRange(element: JetBinaryExpression): TextRange? {
|
||||||
if (element.getOperationToken() !in JetTokens.ALL_ASSIGNMENTS) return null
|
if (element.getOperationToken() !in JetTokens.ALL_ASSIGNMENTS) return null
|
||||||
if (element.getLeft() == null) return null
|
if (element.getLeft() == null) return null
|
||||||
|
|||||||
+2
-1
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.util.TextRange
|
import com.intellij.openapi.util.TextRange
|
||||||
import org.jetbrains.kotlin.idea.intentions.JetSelfTargetingRangeIntention
|
import org.jetbrains.kotlin.idea.intentions.JetSelfTargetingRangeIntention
|
||||||
@@ -26,7 +27,7 @@ import org.jetbrains.kotlin.psi.JetProperty
|
|||||||
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||||
|
|
||||||
public class UnfoldPropertyToIfIntention : JetSelfTargetingRangeIntention<JetProperty>(javaClass(), "Replace property initializer with 'if' expression") {
|
public class UnfoldPropertyToIfIntention : JetSelfTargetingRangeIntention<JetProperty>(javaClass(), "Replace property initializer with 'if' expression"), LowPriorityAction {
|
||||||
override fun applicabilityRange(element: JetProperty): TextRange? {
|
override fun applicabilityRange(element: JetProperty): TextRange? {
|
||||||
if (!element.isLocal()) return null
|
if (!element.isLocal()) return null
|
||||||
val initializer = element.getInitializer() as? JetIfExpression ?: return null
|
val initializer = element.getInitializer() as? JetIfExpression ?: return null
|
||||||
|
|||||||
+2
-1
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.util.TextRange
|
import com.intellij.openapi.util.TextRange
|
||||||
import org.jetbrains.kotlin.idea.intentions.JetSelfTargetingRangeIntention
|
import org.jetbrains.kotlin.idea.intentions.JetSelfTargetingRangeIntention
|
||||||
@@ -27,7 +28,7 @@ import org.jetbrains.kotlin.psi.JetWhenExpression
|
|||||||
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||||
|
|
||||||
public class UnfoldPropertyToWhenIntention : JetSelfTargetingRangeIntention<JetProperty>(javaClass(), "Replace property initializer with 'when' expression") {
|
public class UnfoldPropertyToWhenIntention : JetSelfTargetingRangeIntention<JetProperty>(javaClass(), "Replace property initializer with 'when' expression"), LowPriorityAction {
|
||||||
override fun applicabilityRange(element: JetProperty): TextRange? {
|
override fun applicabilityRange(element: JetProperty): TextRange? {
|
||||||
if (!element.isLocal()) return null
|
if (!element.isLocal()) return null
|
||||||
val initializer = element.getInitializer() as? JetWhenExpression ?: return null
|
val initializer = element.getInitializer() as? JetWhenExpression ?: return null
|
||||||
|
|||||||
+7
-3
@@ -16,16 +16,20 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.util.TextRange
|
import com.intellij.openapi.util.TextRange
|
||||||
import org.jetbrains.kotlin.idea.intentions.JetSelfTargetingRangeIntention
|
|
||||||
import org.jetbrains.kotlin.psi.*
|
|
||||||
import org.jetbrains.kotlin.idea.core.copied
|
import org.jetbrains.kotlin.idea.core.copied
|
||||||
|
import org.jetbrains.kotlin.idea.intentions.JetSelfTargetingRangeIntention
|
||||||
|
import org.jetbrains.kotlin.psi.JetIfExpression
|
||||||
|
import org.jetbrains.kotlin.psi.JetPsiFactory
|
||||||
|
import org.jetbrains.kotlin.psi.JetReturnExpression
|
||||||
|
import org.jetbrains.kotlin.psi.createExpressionByPattern
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.lastBlockStatementOrThis
|
import org.jetbrains.kotlin.psi.psiUtil.lastBlockStatementOrThis
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||||
|
|
||||||
public class UnfoldReturnToIfIntention : JetSelfTargetingRangeIntention<JetReturnExpression>(javaClass(), "Replace return with 'if' expression") {
|
public class UnfoldReturnToIfIntention : JetSelfTargetingRangeIntention<JetReturnExpression>(javaClass(), "Replace return with 'if' expression"), LowPriorityAction {
|
||||||
override fun applicabilityRange(element: JetReturnExpression): TextRange? {
|
override fun applicabilityRange(element: JetReturnExpression): TextRange? {
|
||||||
val ifExpression = element.getReturnedExpression() as? JetIfExpression ?: return null
|
val ifExpression = element.getReturnedExpression() as? JetIfExpression ?: return null
|
||||||
return TextRange(element.startOffset, ifExpression.getIfKeyword().endOffset)
|
return TextRange(element.startOffset, ifExpression.getIfKeyword().endOffset)
|
||||||
|
|||||||
+4
-4
@@ -16,17 +16,17 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.util.TextRange
|
import com.intellij.openapi.util.TextRange
|
||||||
import org.jetbrains.kotlin.idea.intentions.JetSelfTargetingRangeIntention
|
|
||||||
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.BranchedUnfoldingUtils
|
|
||||||
import org.jetbrains.kotlin.psi.*
|
|
||||||
import org.jetbrains.kotlin.idea.core.copied
|
import org.jetbrains.kotlin.idea.core.copied
|
||||||
|
import org.jetbrains.kotlin.idea.intentions.JetSelfTargetingRangeIntention
|
||||||
|
import org.jetbrains.kotlin.psi.*
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.lastBlockStatementOrThis
|
import org.jetbrains.kotlin.psi.psiUtil.lastBlockStatementOrThis
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||||
|
|
||||||
public class UnfoldReturnToWhenIntention : JetSelfTargetingRangeIntention<JetReturnExpression>(javaClass(), "Replace return with 'when' expression") {
|
public class UnfoldReturnToWhenIntention : JetSelfTargetingRangeIntention<JetReturnExpression>(javaClass(), "Replace return with 'when' expression"), LowPriorityAction {
|
||||||
override fun applicabilityRange(element: JetReturnExpression): TextRange? {
|
override fun applicabilityRange(element: JetReturnExpression): TextRange? {
|
||||||
val whenExpr = element.getReturnedExpression() as? JetWhenExpression ?: return null
|
val whenExpr = element.getReturnedExpression() as? JetWhenExpression ?: return null
|
||||||
if (!JetPsiUtil.checkWhenExpressionHasSingleElse(whenExpr)) return null
|
if (!JetPsiUtil.checkWhenExpressionHasSingleElse(whenExpr)) return null
|
||||||
|
|||||||
+2
-1
@@ -16,13 +16,14 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
package org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.util.TextRange
|
import com.intellij.openapi.util.TextRange
|
||||||
import org.jetbrains.kotlin.idea.intentions.JetSelfTargetingRangeIntention
|
import org.jetbrains.kotlin.idea.intentions.JetSelfTargetingRangeIntention
|
||||||
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.toExpression
|
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.toExpression
|
||||||
import org.jetbrains.kotlin.psi.*
|
import org.jetbrains.kotlin.psi.*
|
||||||
|
|
||||||
public class WhenToIfIntention : JetSelfTargetingRangeIntention<JetWhenExpression>(javaClass(), "Replace 'when' with 'if'") {
|
public class WhenToIfIntention : JetSelfTargetingRangeIntention<JetWhenExpression>(javaClass(), "Replace 'when' with 'if'"), LowPriorityAction {
|
||||||
override fun applicabilityRange(element: JetWhenExpression): TextRange? {
|
override fun applicabilityRange(element: JetWhenExpression): TextRange? {
|
||||||
val entries = element.getEntries()
|
val entries = element.getEntries()
|
||||||
if (entries.isEmpty()) return null
|
if (entries.isEmpty()) return null
|
||||||
|
|||||||
+2
-1
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.intentions.declarations
|
package org.jetbrains.kotlin.idea.intentions.declarations
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.editor.ScrollType
|
import com.intellij.openapi.editor.ScrollType
|
||||||
import com.intellij.openapi.util.TextRange
|
import com.intellij.openapi.util.TextRange
|
||||||
@@ -28,7 +29,7 @@ import org.jetbrains.kotlin.idea.quickfix.moveCaret
|
|||||||
import org.jetbrains.kotlin.lexer.JetTokens
|
import org.jetbrains.kotlin.lexer.JetTokens
|
||||||
import org.jetbrains.kotlin.psi.*
|
import org.jetbrains.kotlin.psi.*
|
||||||
|
|
||||||
public class ConvertMemberToExtensionIntention : JetSelfTargetingRangeIntention<JetCallableDeclaration>(javaClass(), "Convert member to extension") {
|
public class ConvertMemberToExtensionIntention : JetSelfTargetingRangeIntention<JetCallableDeclaration>(javaClass(), "Convert member to extension"), LowPriorityAction {
|
||||||
override fun applicabilityRange(element: JetCallableDeclaration): TextRange? {
|
override fun applicabilityRange(element: JetCallableDeclaration): TextRange? {
|
||||||
val classBody = element.getParent() as? JetClassBody ?: return null
|
val classBody = element.getParent() as? JetClassBody ?: return null
|
||||||
if (classBody.getParent() !is JetClass) return null
|
if (classBody.getParent() !is JetClass) return null
|
||||||
|
|||||||
+2
-1
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.intentions.declarations
|
package org.jetbrains.kotlin.idea.intentions.declarations
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.util.TextRange
|
import com.intellij.openapi.util.TextRange
|
||||||
import org.jetbrains.kotlin.idea.intentions.JetSelfTargetingRangeIntention
|
import org.jetbrains.kotlin.idea.intentions.JetSelfTargetingRangeIntention
|
||||||
@@ -23,7 +24,7 @@ import org.jetbrains.kotlin.idea.intentions.splitPropertyDeclaration
|
|||||||
import org.jetbrains.kotlin.psi.JetProperty
|
import org.jetbrains.kotlin.psi.JetProperty
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||||
|
|
||||||
public class SplitPropertyDeclarationIntention : JetSelfTargetingRangeIntention<JetProperty>(javaClass(), "Split property declaration") {
|
public class SplitPropertyDeclarationIntention : JetSelfTargetingRangeIntention<JetProperty>(javaClass(), "Split property declaration"), LowPriorityAction {
|
||||||
override fun applicabilityRange(element: JetProperty): TextRange? {
|
override fun applicabilityRange(element: JetProperty): TextRange? {
|
||||||
if (!element.isLocal()) return null
|
if (!element.isLocal()) return null
|
||||||
val initializer = element.getInitializer() ?: return null
|
val initializer = element.getInitializer() ?: return null
|
||||||
|
|||||||
Reference in New Issue
Block a user