Hide text in IntelliJ editor?
I just finished writing a plugin to support the rendering of ANSI escape sequences in IntelliJ editor, see here for context. The rendering involves hiding ANSI sequences text, which doesn't seem to be supported out of the box by the current API of IntelliJ Editor. The only option seems to be altering the original text before loading it into the editor, which if done directly would cause the modification of the backing file and lead to the loss of all ANSI sequences.
To workaround this I'm currently listening to opened editors, when I detect an 'ANSI Aware' file (configurable through preferences) I process the original content then load the altered text (without ANSI sequences) into an in-memory file (LightVirtualFile) which I then open in a new editor after closing the original. The approach involves further dirty work to keep the open in-memory files synced to the original, maintain tabs/multi-splitters natural behavior, and allow the reloading of in-memory files upon restart. I did manage to get all this to work, but with quite a few workarounds which make maintenance hard in the future. Any chance I'd be missing something? is there a way to hide text in IntelliJ Editor (folding aside) without actually altering original text?
My current implementation is here.
Please sign in to leave a comment.
The only supported method of hiding text in editor now is folding.
Thanks for the quick reply., after a quick test it turns out folding serves my needs nicely, I mistakenly excluded it from my list of options very early.