How to highlight a line range in gutter bar?
For an example if I want to highlight from line number 11 to 25 of a certain file how can I do that? And also I want to add multiple highlights to the same file with several colors. Idea already does this as shown in the follwing screenshot.
Please sign in to leave a comment.
Use editor.getMarkupModel().addRangeHighlighter() and RangeHighlighter.setErrorStripeMarkColor(). You can create as many such highlighters as you need.
Hi Dimitri, I tried it and could only get text highlighted. What I want to do is to add highlights to the gutter bar as I have shown in the above photo.
Please show the code that you tried to use.
I tried it again and now it works :) thank you Dimitry.
Hi Kasun, I too tried Dmitry's solution, However I am not able to get the gutter Icons. I dont know if thats because I am adding the editor to a Jframe. Can you post your code/ tell what have you done to get the gutter icons?
Thanks
Preetam