diff --git a/src/main/java/com/sjhy/plugin/tool/FileUtils.java b/src/main/java/com/sjhy/plugin/tool/FileUtils.java index f871624..5353261 100644 --- a/src/main/java/com/sjhy/plugin/tool/FileUtils.java +++ b/src/main/java/com/sjhy/plugin/tool/FileUtils.java @@ -150,6 +150,8 @@ public class FileUtils { PsiDirectory finalPsiDirectory = psiDirectory; PsiFile finalFile = WriteCommandAction.runWriteCommandAction(saveFile.getProject(), (Computable) () -> { if (oldFile == null) { + // 提交所有改动,并非VCS中的提交文件 + PsiDocumentManager.getInstance(saveFile.getProject()).commitAllDocuments(); return (PsiFile) finalPsiDirectory.add(saveFile.getFile()); } else { // 对旧文件进行替换操作