1
0
mirror of https://github.com/mamoe/mirai.git synced 2025-01-31 03:22:36 +08:00
mirai/tools/intellij-plugin/src/QuickFixRegistrar.kt

34 lines
1.4 KiB
Kotlin
Raw Normal View History

2020-10-28 13:35:15 +08:00
/*
* Copyright 2019-2020 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
package net.mamoe.mirai.console.intellij
import com.intellij.codeInsight.intention.IntentionAction
import net.mamoe.mirai.console.compiler.common.diagnostics.MiraiConsoleErrors
import net.mamoe.mirai.console.intellij.diagnostics.fix.AddSerializerFix
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory
import org.jetbrains.kotlin.idea.quickfix.KotlinIntentionActionsFactory
import org.jetbrains.kotlin.idea.quickfix.QuickFixContributor
import org.jetbrains.kotlin.idea.quickfix.QuickFixes
class QuickFixRegistrar : QuickFixContributor {
override fun registerQuickFixes(quickFixes: QuickFixes) {
fun DiagnosticFactory<*>.registerFactory(vararg factory: KotlinIntentionActionsFactory) {
quickFixes.register(this, *factory)
}
2020-11-08 09:52:29 +08:00
@Suppress("unused")
fun DiagnosticFactory<*>.registerActions(vararg action: IntentionAction) {
quickFixes.register(this, *action)
}
MiraiConsoleErrors.UNSERIALIZABLE_TYPE.registerFactory(AddSerializerFix)
}
}