User: joe Date: 16 Nov 26 14:28 Revision: f4c65f76b99f3b57d1e119fed498b87be08cc5b7 Summary: Add quick fix to ignore LocalMayUseNameInspection when argsOnly = true TeamCity URL: http://ci.mcdev.io:80/viewModification.html?tab=vcsModificationFiles&modId=10808&personal=false Index: src/main/kotlin/platform/mixin/inspection/mixinextras/LocalMayUseNameInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/mixinextras/LocalMayUseNameInspection.kt (revision 9182f4242ed4149f0f10a39abbfbfcbc5740f14b) +++ src/main/kotlin/platform/mixin/inspection/mixinextras/LocalMayUseNameInspection.kt (revision f4c65f76b99f3b57d1e119fed498b87be08cc5b7) @@ -90,6 +90,10 @@ fixes += IgnoreForImplicitLocalsFix() } + if (localInfo.argsOnly) { + fixes += IgnoreWhenArgsOnlyFix() + } + holder.registerProblem( problemElement, MCDevBundle("inspection.local_may_use_name.message"), @@ -107,4 +111,14 @@ } } } + + private inner class IgnoreWhenArgsOnlyFix : ModCommandQuickFix(), LowPriorityAction { + override fun getFamilyName() = MCDevBundle("inspection.may_use_name.option.ignore_args_only") + + override fun perform(project: Project, descriptor: ProblemDescriptor): ModCommand { + return ModCommand.updateInspectionOption(descriptor.psiElement, this@LocalMayUseNameInspection) { + it.ignoreWhenArgsOnly = true -} + } + } + } +} Index: src/main/resources/messages/MinecraftDevelopmentBundle.properties =================================================================== --- src/main/resources/messages/MinecraftDevelopmentBundle.properties (revision 9182f4242ed4149f0f10a39abbfbfcbc5740f14b) +++ src/main/resources/messages/MinecraftDevelopmentBundle.properties (revision f4c65f76b99f3b57d1e119fed498b87be08cc5b7) @@ -484,6 +484,7 @@ inspection.local_variable_declaration_side_only.message.var_cross_annotated_method=A local variable whose class is annotated with {0} cannot be used in a method annotated with {1} inspection.local_variable_declaration_side_only.message.var_unannotated_method=A local variable whose class is annotated with {0} cannot be used in an un-annotated method. inspection.may_use_name.fix=Use variable name ''{0}'' +inspection.may_use_name.option.ignore_args_only=Ignore when argsOnly = true inspection.may_use_name.option.ignore_implicit=Ignore for implicit locals inspection.method_call_side_only.name=Invalid usage of method annotated with @SideOnly inspection.method_call_side_only.fix=Remove @SideOnly annotation from method declaration