void () { FileDocumentManager fileDocumentManager = FileDocumentManager.getInstance(); Set<String> ignoreFileNames = VcsUtil.getVcsIgnoreFileNames(myProject); for (Document document : fileDocumentManager.getUnsavedDocuments()) { VirtualFile file = fileDocumentManager.getFile(document); if (file != null && ignoreFileNames.contains(file.getName())) { ApplicationManager.getApplication().invokeAndWait(() -> fileDocumentManager.saveDocument(document)); } } }