boolean (@NotNull Document document, @NotNull List<? extends BooleanRunnable> finishProcessors, @NotNull List<? extends BooleanRunnable> reparseInjectedProcessors, boolean synchronously) { if (isEventSystemEnabled(document)) { ThreadingAssertions.assertEventDispatchThread(); } if (myProject.isDisposed()) return false; assert !(document instanceof DocumentWindow); VirtualFile virtualFile = FileDocumentManager.getInstance().getFile(document); if (virtualFile != null) { getSmartPointerManager().fastenBelts(virtualFile); } FileViewProvider viewProvider = getCachedViewProvider(document); AtomicBoolean success = new AtomicBoolean(true); executeInsideCommit(()-> { try { success.set(ProgressManager.getInstance().computeInNonCancelableSection(() -> { if (viewProvider == null) { handleCommitWithoutPsi(document); return true; } return commitToExistingPsi(document, finishProcessors, reparseInjectedProcessors, synchronously, virtualFile); })); } catch (Throwable e) { try { forceReload(virtualFile, viewProvider); } finally { LOG.error("Exception while committing " + viewProvider + ", eventSystemEnabled=" + isEventSystemEnabled(document), e); } } finally { if (success.get()) { myUncommittedDocuments.remove(document); } } }); return success.get(); }