List<RangeHighlighter> () { MarkupModel model = DocumentMarkupModel.forDocument(myConsole.getEditor().getDocument(), getProject(), true); RangeHighlighter[] highlighters = model.getAllHighlighters(); Arrays.sort(highlighters, Comparator.comparingInt(RangeMarker::getStartOffset).thenComparingInt(RangeMarker::getEndOffset)); return Arrays.asList(highlighters); }