mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-10 18:40:15 +08:00
Support PluginMainLineMarkerProvider for Java classes
This commit is contained in:
parent
8ac8089015
commit
6d02aa72d9
@ -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);
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user