DocumentWindow (@NotNull DocumentWindow document) { Place shreds = ((DocumentWindowImpl)document).getShreds(); Project project = shreds.getHostPointer().getProject(); DocumentEx delegate = ((PsiDocumentManagerBase)PsiDocumentManager.getInstance(project)).getLastCommittedDocument(document.getDelegate()); Place place = new Place(); place.addAll(ContainerUtil.map(shreds, shred -> ((ShredImpl)shred).withPsiRange())); return new DocumentWindowImpl(delegate, place); }