Is there a way to display gutter icons during execution?
已回答
I created given RelatedItemLineMarkerProvider implementation:
public class FserLineMarker extends RelatedItemLineMarkerProvider {
@Override
protected void collectNavigationMarkers(@NotNull PsiElement element,
@NotNull Collection<? super RelatedItemLineMarkerInfo<?>> result) {
if (element instanceof JBehaveStep) {
NavigationGutterIconBuilder<PsiElement> builder = NavigationGutterIconBuilder.create(SUCCESS_ICON)
.setTarget(null)
.setTooltipText("Step passed: " + element.getText())
.setPopupTitle(element.getFirstChild().getText());
result.add(builder.createLineMarkerInfo(element.getFirstChild()));
DefaultRunExecutor.getRunExecutorInstance();
}
}
…
}
Unfortunately, it seems like all the line marker gutter icons are being rendered whole just after indexing ends. Is there any way to display gutter icons any time, e.g. during program execution?
I want to display execution progress by using gutter icons, so whenever the line of code finishes successfully, I would like to display some success icon. The same goes for failing lines.
请先登录再写评论。
Hi Patryk,
Please try implementing DumbAware:
Hello Karol,
Thanks for your response. Unfortunately, DumbAware probably isn't the thing I'm searching for.
Gutter icons being not displayed during the indices update are not the problem, the problem is that I would like to decide about the precise moment they should they appear. I want to do it in the moment of running the code.
Oh, sorry for misunderstanding you.
Could you please clarify your use case? Why do you need it during program execution only?
I want to display execution progress by using gutter icons, so whenever the line of code finishes successfully, I would like to display some success icon. The same goes for failing lines.
Hello. The LineMarker API is intended for highlighting some useful information about the document text in the gutter (the space to the left of the line). It does so by calling LineMarkerProviders as infrequently as possible, whenever something changed in the document. Which typically happens when the user types something into the document. Calling LineMarkerProviders more often than that would be very expensive, causing freezes and stutters. So it seems line markers don't fit in your use case. To draw somrthing more dynamic, I think you'll have to do it at the lower level: create and update RangeHighlighters yourself, e.g. on timer event. See com.intellij.openapi.editor.markup.MarkupModel#addLineHighlighter()