How to add a tooltip to a Highlighted text?
This will highlight the text but won't set the tooltip. I want to use RangeHighlighter for this. Not annotator.
int lineStartOffset = document.getLineStartOffset(Math.max(0, (Integer) line.get(i)-1)) + (Integer) column.get(i) - 1;
int lineEndOffset = document.getLineStartOffset(Math.max(0, (Integer) line.get(i) -1)) + (Integer) end.get(i);
editor.getMarkupModel().addRangeHighlighter(
lineStartOffset, lineEndOffset,3333, x, HighlighterTargetArea.EXACT_RANGE
).setErrorStripeTooltip(tooltip);
Please sign in to leave a comment.
RangeHighlighter-s don't support easy addition of tooltips, you'll need to implement showing them yourselves, by registering an editor mouse motion listener (see com.intellij.codeInsight.daemon.impl.DaemonListeners.MyEditorMouseMotionListener as an example).
I tried using Annotator like below and registered it in plugin.xml. But method annotate does not get called.