RangeMarker (@NotNull Editor editor, @NotNull Project project, int offset) { ThreadingAssertions.assertEventDispatchThread(); RangeMarker[] marker = new RangeMarker[1]; MarkupModelEx model = (MarkupModelEx)DocumentMarkupModel.forDocument(editor.getDocument(), project, true); model.processRangeHighlightersOverlappingWith(offset, offset, m->{ if (getTokenType(m) == null || m.getStartOffset() > offset || offset + 1 > m.getEndOffset()) return true; marker[0] = m; return false; }); return marker[0]; }