void (@NotNull DocumentEvent event) { Document document = event.getDocument(); PsiDocumentManagerImpl documentManager = (PsiDocumentManagerImpl)PsiDocumentManager.getInstance(myProject); if (documentManager.getSynchronizer().isInSynchronization(document)) { return; } PsiFile psi = documentManager.getCachedPsiFile(document); if (psi == null || !psi.getViewProvider().isEventSystemEnabled()) { return; } if (document.getUserData(UPDATE_ON_COMMIT_ENGAGED) == null) { document.putUserData(UPDATE_ON_COMMIT_ENGAGED, Boolean.TRUE); documentManager.addRunOnCommit(document, () -> { if (document.getUserData(UPDATE_ON_COMMIT_ENGAGED) != null) { updateChangesForDocument(document); document.putUserData(UPDATE_ON_COMMIT_ENGAGED, null); } }); } }