RangeHighlighter (Editor editor, final PsiElement node, TextAttributes attrs, Config cfg) { TextRange range; final PsiElement realElement; if ((node instanceof XmlTag tag) && cfg.isHighlightStartTagOnly()) { realElement = MyPsiUtil.getNameElement(tag); range = realElement.getTextRange(); } else { range = node.getTextRange(); realElement = node; } // TODO: break at line boundaries final ArrayList<RangeHighlighter> highlighters = new ArrayList<>(1); final HighlightManager mgr = HighlightManager.getInstance(editor.getProject()); mgr.addRangeHighlight(editor, range.getStartOffset(), range.getEndOffset(), attrs, false, highlighters); final RangeHighlighter rangeHighlighter = highlighters.get(0); if (cfg.isAddErrorStripe()) { rangeHighlighter.setErrorStripeMarkColor(attrs.getBackgroundColor()); rangeHighlighter.setErrorStripeTooltip(formatTooltip(editor, realElement)); } else { rangeHighlighter.setErrorStripeMarkColor(null); } return rangeHighlighter; }