How to use the Editor to render a custom PsiElement tree

I convert a string to a PsiElement tree, How to use the com.intellij.openapi.editor.Editor to render it, and click on the PsiElement node text?

0

Please clarify what you need.

To display some text in Editor, you can do

editor.getDocument().setText(text)
0

I do not just show the text (not code), but also highlight, collapse, and click on it. How do I do that?

0

You can do custom highlighting using markup model:

editor.getMarkupModel().addRangeHighlighter(...)

foldling - using folding model:

editor.getFoldingModel().addFoldRegion(...)

Not sure what do you mean by 'click', but you can implement any logic in custom mouse listener added via

editor.addEditorMouseListener(...)
0

Thank you very much, can you help me with a problem:

https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000710464-How-to-set-the-editor-s-background-and-overwrite-the-background-image 

Remove the editor's background image and caret row background in Popup?

0

To hide caret and caret row background in editor, you can do

((EditorEx)editor).setRendererMode(true)

As for disabling background image, I'll ask another person to respond, who knows better.

0

请先登录再写评论。