From 6d02aa72d9e2a42935d51b4141a8daffe2e3f3d9 Mon Sep 17 00:00:00 2001 From: Him188 Date: Wed, 3 Feb 2021 21:31:31 +0800 Subject: [PATCH] Support PluginMainLineMarkerProvider for Java classes --- .../src/main/java/test/TestJavaPlugin.java | 10 ++++++++++ .../src/line/marker/PluginMainLineMarkerProvider.kt | 3 +-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 tools/intellij-plugin/run/projects/test-project/src/main/java/test/TestJavaPlugin.java diff --git a/tools/intellij-plugin/run/projects/test-project/src/main/java/test/TestJavaPlugin.java b/tools/intellij-plugin/run/projects/test-project/src/main/java/test/TestJavaPlugin.java new file mode 100644 index 000000000..468afdad0 --- /dev/null +++ b/tools/intellij-plugin/run/projects/test-project/src/main/java/test/TestJavaPlugin.java @@ -0,0 +1,10 @@ +package test; + +import net.mamoe.mirai.console.plugin.jvm.JvmPluginDescription; +import org.jetbrains.annotations.NotNull; + +public class TestJavaPlugin extends net.mamoe.mirai.console.plugin.jvm.JavaPlugin { + public TestJavaPlugin(@NotNull JvmPluginDescription description) { + super(description); + } +} diff --git a/tools/intellij-plugin/src/line/marker/PluginMainLineMarkerProvider.kt b/tools/intellij-plugin/src/line/marker/PluginMainLineMarkerProvider.kt index be747a815..e47761290 100644 --- a/tools/intellij-plugin/src/line/marker/PluginMainLineMarkerProvider.kt +++ b/tools/intellij-plugin/src/line/marker/PluginMainLineMarkerProvider.kt @@ -18,14 +18,13 @@ import net.mamoe.mirai.console.intellij.Icons import net.mamoe.mirai.console.intellij.resolve.allSuperNames import net.mamoe.mirai.console.intellij.resolve.getElementForLineMark import net.mamoe.mirai.console.intellij.util.runIgnoringErrors -import org.jetbrains.kotlin.psi.KtObjectDeclaration class PluginMainLineMarkerProvider : LineMarkerProvider { override fun getLineMarkerInfo(element: PsiElement): LineMarkerInfo<*>? { - if (element !is KtObjectDeclaration) return null runIgnoringErrors { // not showing icons is better than throwing exception every time doing inspection if (element.allSuperNames.any { it == PLUGIN_FQ_NAME }) return Info(getElementForLineMark(element)) } + return null }