IntelliJ SDK: Best practice of run line marker
Answered
Hi, I'm writing a plugin for intellij, and I implement my line marker extends the RunLineMarkerContributor.
the LineMarkers seems only listened the document change event.
if I just programmatic do something on virtual file to satisfied the icon render conditions, the icon not rendered.
but when I input some characters to the virtual file, the LineMarkers updated and icon rendered.
so I write some code like:
Editor editor = e.getRequiredData(CommonDataKeys.EDITOR);
Document document = editor.getDocument();
WriteCommandAction.runWriteCommandAction(project, () -> document.insertString(0, " "));
WriteCommandAction.runWriteCommandAction(project, () -> document.deleteString(0, 1));
to simulate the document change. the LineMarks updated as expected.
My question is that is there a good way to update LineMarkers programmatically?
like EditorNofitications
EditorNotifications.getInstance(project).updateNotifications(virtualFile);
Thank you.
Please sign in to leave a comment.
Xfslove,
You can try with DaemonCodeAnalyzer#restart(PsiFIle)
Thanks, It's exactly what I wanted!