void (Runnable r) { letSaveAllDocumentsPassIfAny(); watchDocumentChanges(r::run, event -> { Document changed = event.getDocument(); VirtualFile file = FileDocumentManager.getInstance().getFile(changed); if (file != null && file.isInLocalFileSystem()) { throw new AssertionError("Unexpected document change: " + changed); } }); }