List<TextRange> (@NotNull DocumentWindow window) { List<TextRange> result = new ArrayList<>(); int offset = 0; for (PsiLanguageInjectionHost.Shred shred : ((DocumentWindowImpl)window).getShreds()) { Segment hostRange = shred.getHostRangeMarker(); if (hostRange == null) continue; offset = appendRange(result, offset, shred.getPrefix().length()); offset += hostRange.getEndOffset() - hostRange.getStartOffset(); offset = appendRange(result, offset, shred.getSuffix().length()); } return result; }