void (@NotNull Map<? super VirtualFile, ? super Document> strongRefsToDocuments, @NotNull VirtualFile virtualFile) { Document document = myFileDocumentManager.getCachedDocument(virtualFile); if (document == null && DocumentImpl.areRangeMarkersRetainedFor(virtualFile)) { // re-create document with the old contents prior to this event // then contentChanged() will diff the document with the new contents and update the markers document = myFileDocumentManager.getDocument(virtualFile); } // save document strongly to make it live until contentChanged() if (document != null) { strongRefsToDocuments.put(virtualFile, document); } }