void (@NotNull Project project, @NotNull PsiDocumentManagerBase documentManager, @NotNull Document document, @NonNls @NotNull Object reason, @NotNull ModalityState modality, @NotNull FileViewProvider cachedViewProvider) { assert !isDisposed : "already disposed"; if (!project.isInitialized()) return; if (documentManager.myProject != project) { throw new IllegalArgumentException("Wrong project: "+project+"; expected: "+documentManager.myProject); } assert cachedViewProvider.isEventSystemEnabled() : "Asynchronous commit is only supported for physical PSI" + ", document=" + document + ", cachedViewProvider=" + cachedViewProvider +" ("+cachedViewProvider.getClass()+")"; TransactionGuard.getInstance().assertWriteSafeContext(modality); CommitTask task = new CommitTask(project, document, reason, modality, documentManager.getLastCommittedText(document), cachedViewProvider); ReadAction .nonBlocking(() -> commitUnderProgress(task, false, documentManager)) .expireWhen(() -> project.isDisposed() || isDisposed || !documentManager.isInUncommittedSet(document) || !task.isStillValid()) .coalesceBy(task) .finishOnUiThread(modality, Runnable::run) .submit(executor); }