[kotlin] KTIJ-29133 parameters renamed to avoid naming conflicts

GitOrigin-RevId: 2e17873eccb4a48918c2fa35901b252cc99668d1
This commit is contained in:
Andrew Kozlov
2024-03-28 22:10:23 +00:00
committed by intellij-monorepo-bot
parent 2a1b00e11d
commit 03cda69999
60 changed files with 210 additions and 205 deletions
@@ -46,19 +46,19 @@ sealed class KotlinPsiUpdateModCommandAction<E : PsiElement, C : Any> private co
*/
@RequiresBackgroundThread
protected abstract fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: E,
elementContext: C,
updater: ModPsiUpdater,
)
protected abstract fun getElementContext(
context: ActionContext,
actionContext: ActionContext,
element: E,
): C?
protected open fun getActionName(
context: ActionContext,
actionContext: ActionContext,
element: E,
elementContext: C,
): @IntentionName String = familyName
@@ -76,7 +76,7 @@ sealed class KotlinPsiUpdateModCommandAction<E : PsiElement, C : Any> private co
) : KotlinPsiUpdateModCommandAction<E, C>(element, null) {
final override fun getElementContext(
context: ActionContext,
actionContext: ActionContext,
element: E,
): C = elementContext
}
@@ -87,7 +87,7 @@ sealed class KotlinPsiUpdateModCommandAction<E : PsiElement, C : Any> private co
ContextProvider<E, C> {
final override fun getElementContext(
context: ActionContext,
actionContext: ActionContext,
element: E,
): C? = getElementContext(element)
}
@@ -62,7 +62,7 @@ internal object AddDataModifierFixFactory {
) : KotlinPsiUpdateModCommandAction.ElementBased<KtClass, ElementContext>(ktClass, context) {
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: KtClass,
elementContext: ElementContext,
updater: ModPsiUpdater,
@@ -55,7 +55,7 @@ internal object AddFunModifierFixFactory {
KotlinPsiUpdateModCommandAction.ElementBased<KtClass, ElementContext>(ktClass, context) {
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: KtClass,
elementContext: ElementContext,
updater: ModPsiUpdater,
@@ -44,7 +44,7 @@ internal object AddInlineModifierFix {
) : KotlinPsiUpdateModCommandAction.ElementBased<KtParameter, ElementContext>(parameter, context) {
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: KtParameter,
elementContext: ElementContext,
updater: ModPsiUpdater,
@@ -55,7 +55,7 @@ internal object AddInlineModifierFix {
}
}
override fun getActionName(context: ActionContext, element: KtParameter, elementContext: ElementContext): String {
override fun getActionName(actionContext: ActionContext, element: KtParameter, elementContext: ElementContext): String {
return KotlinBundle.message("fix.add.modifier.inline.parameter.text", elementContext.modifier, element.name.toString())
}
@@ -37,7 +37,7 @@ internal object AddSuspendModifierFixFactory {
) : KotlinPsiUpdateModCommandAction.ElementBased<KtModifierListOwner, ElementContext>(element, context) {
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: KtModifierListOwner,
elementContext: ElementContext,
updater: ModPsiUpdater,
@@ -37,7 +37,7 @@ object CastExpressionFixFactories {
override fun getFamilyName(): String = KotlinBundle.message("fix.cast.expression.family")
override fun getActionName(
context: ActionContext,
actionContext: ActionContext,
element: PsiElement,
elementContext: ElementContext,
): String = KotlinBundle.message(
@@ -47,12 +47,12 @@ object CastExpressionFixFactories {
)
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: PsiElement,
elementContext: ElementContext,
updater: ModPsiUpdater,
) {
val expressionToInsert = KtPsiFactory(context.project)
val expressionToInsert = KtPsiFactory(actionContext.project)
.createExpressionByPattern(
"$0 as $1",
element,
@@ -38,7 +38,7 @@ object ChangeVisibilityFixFactories {
)
override fun getActionName(
context: ActionContext,
actionContext: ActionContext,
element: KtDeclaration,
elementContext: ElementContext,
): String = KotlinBundle.message(
@@ -48,7 +48,7 @@ object ChangeVisibilityFixFactories {
)
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: KtDeclaration,
elementContext: ElementContext,
updater: ModPsiUpdater,
@@ -30,12 +30,12 @@ object InitializePropertyQuickFixFactories {
override fun getFamilyName(): String = KotlinBundle.message("add.initializer")
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: KtProperty,
elementContext: ElementContext,
updater: ModPsiUpdater,
) {
val expression = KtPsiFactory(context.project)
val expression = KtPsiFactory(actionContext.project)
.createExpression(elementContext.initializerText)
val initializer = element.setInitializer(expression)!!
updater.select(TextRange(initializer.startOffset, initializer.endOffset))
@@ -38,7 +38,7 @@ object SimplifyComparisonFixFactory {
) : KotlinPsiUpdateModCommandAction.ElementBased<KtExpression, ElementContext>(psiElement, context) {
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: KtExpression,
elementContext: ElementContext,
updater: ModPsiUpdater,
@@ -73,12 +73,12 @@ internal object SuperClassNotInitializedFactories {
)
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: KtSuperTypeEntry,
elementContext: ElementContext,
updater: ModPsiUpdater,
) {
val withParenthesis = element.replaced(KtPsiFactory(context.project).createSuperTypeCallEntry(element.text + "()"))
val withParenthesis = element.replaced(KtPsiFactory(actionContext.project).createSuperTypeCallEntry(element.text + "()"))
if (elementContext.moveCaretIntoParenthesis) {
withParenthesis.valueArgumentList?.leftParenthesis?.endOffset?.let { offset ->
updater.moveCaretTo(offset)
@@ -32,13 +32,13 @@ object SurroundWithArrayOfWithSpreadOperatorInFunctionFixFactory {
override fun getFamilyName(): String = KotlinBundle.message("surround.with.array.of")
override fun getActionName(
context: ActionContext,
actionContext: ActionContext,
element: KtExpression,
elementContext: ElementContext,
): String = KotlinBundle.getMessage("surround.with.0", elementContext.shortArrayOfCall)
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: KtExpression,
elementContext: ElementContext,
updater: ModPsiUpdater,
@@ -68,7 +68,7 @@ object WrapWithSafeLetCallFixFactories {
override fun getFamilyName(): String = KotlinBundle.message("wrap.with.let.call")
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: KtExpression,
elementContext: ElementContext,
updater: ModPsiUpdater,
@@ -34,7 +34,7 @@ internal class AddFullQualifierIntention :
}
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: KtNameReferenceExpression,
elementContext: Context,
updater: ModPsiUpdater,
@@ -29,9 +29,9 @@ internal class AddNameToArgumentIntention :
override fun getFamilyName(): String = KotlinBundle.message("add.name.to.argument")
override fun getActionName(
context: ActionContext,
element: KtValueArgument,
elementContext: Context,
actionContext: ActionContext,
element: KtValueArgument,
elementContext: Context,
): String = KotlinBundle.message("add.0.to.argument", elementContext.argumentName)
override fun getApplicableRanges(element: KtValueArgument): List<TextRange> =
@@ -56,7 +56,7 @@ internal class AddNameToArgumentIntention :
}
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: KtValueArgument,
elementContext: Context,
updater: ModPsiUpdater,
@@ -35,10 +35,10 @@ internal class AddNamesInCommentToJavaCallArgumentsIntention :
override fun prepareContext(element: KtCallElement): Context? = getArgumentNameComments(element)?.let { Context(it) }
override fun invoke(
context: ActionContext,
element: KtCallElement,
elementContext: Context,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtCallElement,
elementContext: Context,
updater: ModPsiUpdater,
) {
val nameCommentsMap = elementContext.nameCommentsByArgument.dereferenceValidKeys()
val psiFactory = KtPsiFactory(element)
@@ -53,10 +53,10 @@ internal class AddNamesToCallArgumentsIntention :
}
override fun invoke(
context: ActionContext,
element: KtCallElement,
elementContext: Context,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtCallElement,
elementContext: Context,
updater: ModPsiUpdater,
) {
addArgumentNames(elementContext.argumentNames.dereferenceValidKeys())
}
@@ -57,10 +57,10 @@ internal class AddNamesToFollowingArgumentsIntention :
?.let(::Context)
override fun invoke(
context: ActionContext,
element: KtValueArgument,
elementContext: Context,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtValueArgument,
elementContext: Context,
updater: ModPsiUpdater,
) {
addArgumentNames(elementContext.argumentNames.dereferenceValidKeys())
}
@@ -54,10 +54,10 @@ internal class AddOpenModifierIntention :
}
override fun invoke(
context: ActionContext,
element: KtCallableDeclaration,
elementContext: Unit,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtCallableDeclaration,
elementContext: Unit,
updater: ModPsiUpdater,
) {
element.addModifier(KtTokens.OPEN_KEYWORD)
}
@@ -65,10 +65,10 @@ internal abstract class AbstractAddAccessorIntention(
}
override fun invoke(
context: ActionContext,
element: KtProperty,
elementContext: Unit,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtProperty,
elementContext: Unit,
updater: ModPsiUpdater,
) {
addAccessors(element, addGetter, addSetter, updater::moveCaretTo)
}
@@ -27,10 +27,10 @@ internal class AddWhenRemainingBranchesIntention :
}
override fun invoke(
context: ActionContext,
element: KtWhenExpression,
elementContext: AddRemainingWhenBranchesUtils.Context,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtWhenExpression,
elementContext: AddRemainingWhenBranchesUtils.Context,
updater: ModPsiUpdater,
) {
addRemainingWhenBranches(element, elementContext)
}
@@ -29,7 +29,7 @@ sealed class ChangeVisibilityModifierIntention(
) : KotlinApplicableModCommandAction<KtDeclaration, Unit>(KtDeclaration::class) {
override fun getActionName(
context: ActionContext,
actionContext: ActionContext,
element: KtDeclaration,
elementContext: Unit,
): String {
@@ -117,7 +117,7 @@ sealed class ChangeVisibilityModifierIntention(
}
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: KtDeclaration,
elementContext: Unit,
updater: ModPsiUpdater,
@@ -21,9 +21,9 @@ internal class ConvertBinaryExpressionWithDemorgansLawIntention :
override fun getFamilyName(): String = KotlinBundle.message("demorgan.law")
override fun getActionName(
context: ActionContext,
element: KtBinaryExpression,
elementContext: DemorgansLawUtils.Context,
actionContext: ActionContext,
element: KtBinaryExpression,
elementContext: DemorgansLawUtils.Context,
): String = when (element.topmostBinaryExpression().operationToken) {
KtTokens.ANDAND -> KotlinBundle.message("replace.&&.with.||")
KtTokens.OROR -> KotlinBundle.message("replace.||.with.&&")
@@ -44,7 +44,7 @@ internal class ConvertBinaryExpressionWithDemorgansLawIntention :
}
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: KtBinaryExpression,
elementContext: DemorgansLawUtils.Context,
updater: ModPsiUpdater,
@@ -32,10 +32,10 @@ internal class ConvertConcatenationToBuildStringIntention :
}
override fun invoke(
context: ActionContext,
element: KtBinaryExpression,
elementContext: Unit,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtBinaryExpression,
elementContext: Unit,
updater: ModPsiUpdater,
) {
val buildStringCall = convertConcatenationToBuildStringCall(element)
shortenReferences(buildStringCall)
@@ -106,10 +106,10 @@ internal class ConvertForEachToForLoopIntention
}
override fun invoke(
context: ActionContext,
element: KtCallExpression,
elementContext: Context,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtCallExpression,
elementContext: Context,
updater: ModPsiUpdater,
) {
val qualifiedExpression = element.getQualifiedExpressionForSelector()
val receiverExpression = qualifiedExpression?.receiverExpression
@@ -40,9 +40,9 @@ internal class ConvertLambdaToReferenceIntention :
override fun getFamilyName(): String = KotlinBundle.message("convert.lambda.to.reference.before.text")
override fun getActionName(
context: ActionContext,
element: KtLambdaExpression,
elementContext: Context,
actionContext: ActionContext,
element: KtLambdaExpression,
elementContext: Context,
): String = KotlinBundle.message("convert.lambda.to.reference")
override fun isApplicableByPsi(element: KtLambdaExpression): Boolean {
@@ -136,7 +136,7 @@ internal class ConvertLambdaToReferenceIntention :
}
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: KtLambdaExpression,
elementContext: Context,
updater: ModPsiUpdater,
@@ -153,7 +153,7 @@ internal class ConvertLambdaToReferenceIntention :
val outerCallExpression = parent.getStrictParentOfType<KtCallExpression>()
if (outerCallExpression != null) {
elementContext.renderedTypeArguments?.let {
addTypeArguments(outerCallExpression, it, context.project)
addTypeArguments(outerCallExpression, it, actionContext.project)
outerCallExpression.typeArgumentList?.let(::shortenReferences)
}
}
@@ -41,10 +41,10 @@ internal class ConvertPropertyGetterToInitializerIntention :
}
override fun invoke(
context: ActionContext,
element: KtPropertyAccessor,
elementContext: Unit,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtPropertyAccessor,
elementContext: Unit,
updater: ModPsiUpdater,
) {
val property = element.parent as? KtProperty ?: return
val commentSaver = CommentSaver(property)
@@ -30,10 +30,10 @@ internal class ConvertReferenceToLambdaIntention :
}
override fun invoke(
context: ActionContext,
element: KtCallableReferenceExpression,
elementContext: String,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtCallableReferenceExpression,
elementContext: String,
updater: ModPsiUpdater,
) {
ConvertReferenceToLambdaUtil.convertReferenceToLambdaExpression(element, elementContext)
}
@@ -26,10 +26,10 @@ internal class ConvertStringTemplateToBuildStringIntention :
}
override fun invoke(
context: ActionContext,
element: KtStringTemplateExpression,
elementContext: Unit,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtStringTemplateExpression,
elementContext: Unit,
updater: ModPsiUpdater,
) {
val buildStringCall = convertStringTemplateToBuildStringCall(element)
shortenReferences(buildStringCall)
@@ -26,10 +26,10 @@ internal class ConvertToBlockBodyIntention :
ConvertToBlockBodyUtils.createContext(element, ShortenReferencesFacility.getInstance(), reformat = true)
override fun invoke(
context: ActionContext,
element: KtDeclarationWithBody,
elementContext: ConvertToBlockBodyContext,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtDeclarationWithBody,
elementContext: ConvertToBlockBodyContext,
updater: ModPsiUpdater,
) {
ConvertToBlockBodyUtils.convert(element, elementContext)
}
@@ -36,12 +36,12 @@ internal class ConvertToRawStringTemplateIntention :
element.descendantsOfType<KtStringTemplateExpression>().all { it.canBeConvertedToStringLiteral() }
override fun invoke(
context: ActionContext,
element: KtBinaryExpression,
elementContext: Context,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtBinaryExpression,
elementContext: Context,
updater: ModPsiUpdater,
) {
val replaced = elementContext.replacement.element?.let { element.replaced(it) } ?: return
convertToStringLiteral(replaced, context, updater)
convertToStringLiteral(replaced, actionContext, updater)
}
}
@@ -50,10 +50,10 @@ internal class ConvertToStringTemplateIntention :
null
override fun invoke(
context: ActionContext,
element: KtBinaryExpression,
elementContext: Context,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtBinaryExpression,
elementContext: Context,
updater: ModPsiUpdater,
) {
elementContext.replacement.element?.let { element.replaced(updater.getWritable(it)) }
}
@@ -19,10 +19,10 @@ internal class FlattenWhenIntention : KotlinApplicableModCommandAction<KtWhenExp
KotlinBundle.message("flatten.when.expression")
override fun invoke(
context: ActionContext,
element: KtWhenExpression,
elementContext: Unit,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtWhenExpression,
elementContext: Unit,
updater: ModPsiUpdater,
) {
val commentSaver = CommentSaver(element)
val nestedWhen = element.elseExpression as KtWhenExpression
@@ -31,7 +31,12 @@ internal class IfToWhenIntention : KotlinApplicableModCommandAction<KtIfExpressi
override fun prepareContext(element: KtIfExpression) {
}
override fun invoke(context: ActionContext, element: KtIfExpression, elementContext: Unit, updater: ModPsiUpdater) {
override fun invoke(
actionContext: ActionContext,
element: KtIfExpression,
elementContext: Unit,
updater: ModPsiUpdater,
) {
val ifExpression = element.topmostIfExpression()
val parent = ifExpression.parent
@@ -42,9 +42,9 @@ internal class ImportAllMembersIntention :
override fun getFamilyName(): String = KotlinBundle.message("import.members.with")
override fun getActionName(
context: ActionContext,
element: KtExpression,
elementContext: Context,
actionContext: ActionContext,
element: KtExpression,
elementContext: Context,
): String = KotlinBundle.message("import.members.from.0", elementContext.fqName.asString())
override fun isApplicableByPsi(element: KtExpression): Boolean =
@@ -94,7 +94,7 @@ internal class ImportAllMembersIntention :
}
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: KtExpression,
elementContext: Context,
updater: ModPsiUpdater,
@@ -32,9 +32,9 @@ internal class ImportMemberIntention :
override fun getFamilyName(): String = KotlinBundle.message("add.import.for.member")
override fun getActionName(
context: ActionContext,
element: KtNameReferenceExpression,
elementContext: Context,
actionContext: ActionContext,
element: KtNameReferenceExpression,
elementContext: Context,
): String = KotlinBundle.message("add.import.for.0", elementContext.fqName.asString())
override fun isApplicableByPsi(element: KtNameReferenceExpression): Boolean =
@@ -48,7 +48,7 @@ internal class ImportMemberIntention :
}
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: KtNameReferenceExpression,
elementContext: Context,
updater: ModPsiUpdater,
@@ -26,11 +26,11 @@ internal class InsertExplicitTypeArgumentsIntention :
override fun prepareContext(element: KtCallExpression): String? = getRenderedTypeArguments(element)
override fun invoke(
context: ActionContext,
element: KtCallExpression,
elementContext: String,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtCallExpression,
elementContext: String,
updater: ModPsiUpdater,
) {
addTypeArguments(element, elementContext, context.project)
addTypeArguments(element, elementContext, actionContext.project)
}
}
@@ -84,10 +84,10 @@ internal class InvertIfConditionIntention :
}
override fun invoke(
context: ActionContext,
element: KtIfExpression,
elementContext: Context,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtIfExpression,
elementContext: Context,
updater: ModPsiUpdater,
) {
val rBrace = parentBlockRBrace(element)
if (rBrace != null) element.nextEolCommentOnSameLine()?.delete()
@@ -33,9 +33,9 @@ internal class LambdaToAnonymousFunctionIntention :
override fun getFamilyName(): @IntentionFamilyName String = KotlinBundle.message("convert.lambda.expression.to.anonymous.function")
override fun getActionName(
context: ActionContext,
element: KtLambdaExpression,
elementContext: LambdaToFunctionContext,
actionContext: ActionContext,
element: KtLambdaExpression,
elementContext: LambdaToFunctionContext,
): String = KotlinBundle.message("convert.to.anonymous.function")
context(KtAnalysisSession)
@@ -68,7 +68,7 @@ internal class LambdaToAnonymousFunctionIntention :
}
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: KtLambdaExpression,
elementContext: LambdaToFunctionContext,
updater: ModPsiUpdater,
@@ -23,10 +23,10 @@ internal class MovePropertyToConstructorIntention
override fun prepareContext(element: KtProperty): MovePropertyToConstructorInfo? = MovePropertyToConstructorInfo.create(element)
override fun invoke(
context: ActionContext,
element: KtProperty,
elementContext: MovePropertyToConstructorInfo,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtProperty,
elementContext: MovePropertyToConstructorInfo,
updater: ModPsiUpdater,
) {
element.moveToConstructor(elementContext.toWritable(updater))
}
@@ -42,10 +42,10 @@ internal class RemoveAllArgumentNamesIntention :
}
override fun invoke(
context: ActionContext,
element: KtCallElement,
elementContext: ArgumentsDataContext,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtCallElement,
elementContext: ArgumentsDataContext,
updater: ModPsiUpdater,
) {
val oldArguments = elementContext.sortedArguments.map { it.element ?: return }
val varargElement = elementContext.vararg?.let { it.element ?: return }
@@ -27,10 +27,10 @@ internal class RemoveExplicitTypeArgumentsIntention :
areTypeArgumentsRedundant(element).asUnit
override fun invoke(
context: ActionContext,
element: KtTypeArgumentList,
elementContext: Unit,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtTypeArgumentList,
elementContext: Unit,
updater: ModPsiUpdater,
) {
RemoveExplicitTypeArgumentsUtils.applyTo(element)
}
@@ -165,10 +165,10 @@ internal class RemoveExplicitTypeIntention :
override fun getFamilyName(): String = KotlinBundle.message("remove.explicit.type.specification")
override fun invoke(
context: ActionContext,
element: KtDeclaration,
elementContext: Unit,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtDeclaration,
elementContext: Unit,
updater: ModPsiUpdater,
) {
element.removeTypeReference()
}
@@ -74,10 +74,10 @@ internal class RemoveSingleArgumentNameIntention :
}
override fun invoke(
context: ActionContext,
element: KtValueArgument,
elementContext: SingleArgumentContext,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtValueArgument,
elementContext: SingleArgumentContext,
updater: ModPsiUpdater,
) {
val argumentList = element.parent as? KtValueArgumentList ?: return
@@ -56,10 +56,10 @@ internal class ReplaceUnderscoreWithTypeArgumentIntention :
}
override fun invoke(
context: ActionContext,
element: KtTypeProjection,
elementContext: Context,
updater: ModPsiUpdater
actionContext: ActionContext,
element: KtTypeProjection,
elementContext: Context,
updater: ModPsiUpdater
) {
val updatedTypeProjection = elementContext.updatedTypeProjection.dereference() ?: return
val replacedElement = element.replace(updatedTypeProjection) as? KtElement ?: return
@@ -26,10 +26,10 @@ internal class SpecifyExplicitLambdaSignatureIntention :
}
override fun invoke(
context: ActionContext,
element: KtLambdaExpression,
elementContext: String,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtLambdaExpression,
elementContext: String,
updater: ModPsiUpdater,
) {
specifyExplicitLambdaSignature(element, elementContext)
}
@@ -40,9 +40,9 @@ internal class SpecifyTypeExplicitlyIntention:
override fun getFamilyName(): String = KotlinBundle.message("specify.type.explicitly")
override fun getActionName(
context: ActionContext,
element: KtCallableDeclaration,
elementContext: TypeInfo,
actionContext: ActionContext,
element: KtCallableDeclaration,
elementContext: TypeInfo,
): String = when (element) {
is KtFunction -> KotlinBundle.message("specify.return.type.explicitly")
else -> KotlinBundle.message("specify.type.explicitly")
@@ -54,7 +54,7 @@ internal class SpecifyTypeExplicitlyIntention:
else getTypeInfo(element).takeUnless { it.defaultType.isError }
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: KtCallableDeclaration,
elementContext: TypeInfo,
updater: ModPsiUpdater,
@@ -42,10 +42,10 @@ internal class SplitPropertyDeclarationIntention :
}
override fun invoke(
context: ActionContext,
element: KtProperty,
elementContext: Context,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtProperty,
elementContext: Context,
updater: ModPsiUpdater,
) {
val parent = element.parent
@@ -23,12 +23,12 @@ internal class ToRawStringLiteralIntention :
}
override fun invoke(
context: ActionContext,
element: KtStringTemplateExpression,
elementContext: Unit,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtStringTemplateExpression,
elementContext: Unit,
updater: ModPsiUpdater,
) {
convertToStringLiteral(element, context, updater)
convertToStringLiteral(element, actionContext, updater)
}
override fun isApplicableByPsi(element: KtStringTemplateExpression): Boolean = element.canBeConvertedToStringLiteral()
@@ -119,10 +119,10 @@ internal class WhenToIfIntention :
}
override fun invoke(
context: ActionContext,
element: KtWhenExpression,
elementContext: Context,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtWhenExpression,
elementContext: Context,
updater: ModPsiUpdater,
) {
val subject = element.subjectExpression
val temporaryNameForWhenSubject =
@@ -25,9 +25,9 @@ internal class ConvertToForEachFunctionCallIntention :
override fun getFamilyName(): String = KotlinBundle.message("replace.with.a.foreach.function.call", "forEach")
override fun getActionName(
context: ActionContext,
element: KtForExpression,
elementContext: Unit,
actionContext: ActionContext,
element: KtForExpression,
elementContext: Unit,
): String {
val callExpression = element.loopRange?.getPossiblyQualifiedCallExpression()
return KotlinBundle.message(
@@ -68,7 +68,7 @@ internal class ConvertToForEachFunctionCallIntention :
}
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: KtForExpression,
elementContext: Unit,
updater: ModPsiUpdater,
@@ -124,10 +124,10 @@ internal class OperatorToFunctionIntention :
override fun getFamilyName(): String = KotlinBundle.message("replace.overloaded.operator.with.function.call")
override fun invoke(
context: ActionContext,
element: KtExpression,
elementContext: Unit,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtExpression,
elementContext: Unit,
updater: ModPsiUpdater,
) {
OperatorToFunctionConverter.convert(element)
}
@@ -52,13 +52,13 @@ internal class PutCallsOnSeparateLinesIntention :
}
override fun invoke(
context: ActionContext,
element: KtQualifiedExpression,
elementContext: Unit,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtQualifiedExpression,
elementContext: Unit,
updater: ModPsiUpdater,
) {
val rootQualifierExpression = element.topmostQualifierExpression() ?: return
val project = context.project
val project = actionContext.project
val psiFactory = KtPsiFactory(project)
rootQualifierExpression.visitOperations(transformation = callChainTransformation(element)) { qualifierExpression ->
val operationReference = qualifierExpression.operationTokenNode as? PsiElement ?: return@visitOperations
@@ -35,13 +35,13 @@ internal class PutExpressionsOnSeparateLinesIntention :
}
override fun invoke(
context: ActionContext,
element: KtOperationReferenceExpression,
elementContext: Unit,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtOperationReferenceExpression,
elementContext: Unit,
updater: ModPsiUpdater,
) {
val rootBinaryExpression = element.topmostBinaryExpression() ?: return
val project = context.project
val project = actionContext.project
val psiFactory = KtPsiFactory(project)
rootBinaryExpression.visitOperations { operationReference ->
val whiteSpace = operationReference.nextSibling as? PsiWhiteSpace
@@ -26,7 +26,7 @@ internal class SplitIfIntention :
}
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: KtExpression,
elementContext: Unit,
updater: ModPsiUpdater,
@@ -28,10 +28,10 @@ internal class FoldIfToFunctionCallIntention :
override fun prepareContext(element: KtIfExpression): Context? = getFoldingContext(element)
override fun invoke(
context: ActionContext,
element: KtIfExpression,
elementContext: Context,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtIfExpression,
elementContext: Context,
updater: ModPsiUpdater,
) {
fold(element, elementContext)
}
@@ -28,10 +28,10 @@ internal class FoldWhenToFunctionCallIntention :
override fun prepareContext(element: KtWhenExpression): Context? = getFoldingContext(element)
override fun invoke(
context: ActionContext,
element: KtWhenExpression,
elementContext: Context,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtWhenExpression,
elementContext: Context,
updater: ModPsiUpdater,
) {
fold(element, elementContext)
}
@@ -28,10 +28,10 @@ internal class UnfoldFunctionCallToIfIntention :
}
override fun invoke(
context: ActionContext,
element: KtCallExpression,
elementContext: Unit,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtCallExpression,
elementContext: Unit,
updater: ModPsiUpdater,
) {
unfold<KtIfExpression>(element)
}
@@ -28,10 +28,10 @@ internal class UnfoldFunctionCallToWhenIntention :
}
override fun invoke(
context: ActionContext,
element: KtCallExpression,
elementContext: Unit,
updater: ModPsiUpdater,
actionContext: ActionContext,
element: KtCallExpression,
elementContext: Unit,
updater: ModPsiUpdater,
) {
unfold<KtWhenExpression>(element)
}
@@ -31,7 +31,7 @@ class AddToStringFix(
override fun getFamilyName(): String = KotlinBundle.message("fix.add.tostring.call.family")
override fun getActionName(
context: ActionContext,
actionContext: ActionContext,
element: KtExpression,
elementContext: ElementContext,
): String = KotlinBundle.message(
@@ -39,7 +39,7 @@ class AddToStringFix(
)
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: KtExpression,
elementContext: ElementContext,
updater: ModPsiUpdater,
@@ -21,7 +21,7 @@ class UseInheritedVisibilityFix(
)
override fun invoke(
context: ActionContext,
actionContext: ActionContext,
element: KtModifierListOwner,
elementContext: ElementContext,
updater: ModPsiUpdater,