RangeHighlighter (@Nullable TextAttributesKey textAttributesKey, @Nullable TextAttributes textAttributes, int lineNumber, int layer) { Document document = getDocument(); if (!DocumentUtil.isValidLine(lineNumber, document)) { throw new IndexOutOfBoundsException("lineNumber:" + lineNumber + ". Must be in [0, " + (document.getLineCount() - 1) + "]"); } int offset = DocumentUtil.getFirstNonSpaceCharOffset(document, lineNumber); HighlighterTargetArea area = HighlighterTargetArea.LINES_IN_RANGE; Consumer<RangeHighlighterEx> changeAction = textAttributes == null ? null : ex -> ex.setTextAttributes(textAttributes); return addRangeHighlighterAndChangeAttributes(textAttributesKey, offset, offset, layer, area, false, changeAction); }