How to update the text of LeafPsiElement inside HighlightVisitor?
已回答
It seems that the LeafPsiElement does not have a set method of the text field.
请先登录再写评论。
What do you want to achieve? Highlighting should not modify anything in general
To achieve this: https://twitter.com/sanisimov/status/1141919852929658881/photo/1
Is that possible to update the text of a LeafPsiElement? maybe reflection?
Use extension point com.intellij.openapi.editor.EditorLinePainter
Any docs or examples?
com.intellij.xdebugger.impl.evaluate.XDebuggerEditorLinePainter
Thanks, And I need to find a way to pass some information from the HighlightVisitor to EditorLinePainter, because the HighlightVisitor knows some state, so that I could choose how to display according to the state. How can I achieve this?
You can store information in User Data, e.g. on com.intellij.openapi.vfs.VirtualFile and access it later in EditorLinePainter.
And as I see, the EditorLinePainter is run before the HighlightVisitor, so is that works?
What is responsibilty of HighlightVisitor in your use-case? Can't you calculate this data in ELP instead?
So what is "ELP"?
And as I see, the EditorLinePainter does not support emoji at all, at least in version 2017.2
My code looks like:
But actually display as:
Please note that emojis are not supported when you launch your IDE with Oracle JDK, please use JetBrains Runtime instead.