Line Marker Provider not executed
I don’t know why, the code is not executed
<codeInsight.lineMarkerProvider language="JAVA" implementationClass="com.leaniss.smartchat.inlay.MyLineMarkerProvider2"/>
package com.leaniss.smartchat.inlay;
/**
* @Description //TODO
* @Date 2023/12/6 18:17
* @Author yongwangat
**/
public class MyLineMarkerProvider2 implements LineMarkerProvider {
@Nullable
@Override
public LineMarkerInfo<?> getLineMarkerInfo(@NotNull PsiElement element) {
// Only work with method identifiers (to reduce unnecessary checks)
if (element instanceof PsiMethod && element.getFirstChild() != null) {
PsiMethod method = (PsiMethod) element;
// Check if the method name contains "test"
if (method.getName().contains("test")) {
// Provide an appropriate tool tip message
Function<PsiElement, String> tooltipProvider = e -> "Test method: " + method.getName();
return new LineMarkerInfo<>(
element,
element.getTextRange(),
AllIcons.RunConfigurations.TestState.Run, // IntelliJ's test icon
tooltipProvider,
null, // No click action
GutterIconRenderer.Alignment.LEFT
);
}
}
return null;
}
}
Please sign in to leave a comment.
Hi,
It's impossible to tell what the reason is without more details. What file do you run it on? Did you set a debugger breakpoint in this method?
Also, please name topics more accurately. In this case, I'm renaming it from “Line Marker Provider” to “Line Marker Provider not executed”.