save document before creating student file
[idea/community.git] / python / educational-core / student / src / com / jetbrains / edu / learning / core / EduUtils.java
index 4a2e549ac7be63558ef78e33ee615032b8249b72..9966a7b80ebd3dd005255664a2d16555d074e8e1 100644 (file)
@@ -111,6 +111,10 @@ public class EduUtils {
 
 
   public static VirtualFile copyFile(Object requestor, VirtualFile toDir, VirtualFile file) {
+    Document document = FileDocumentManager.getInstance().getDocument(file);
+    if (document != null) {
+      FileDocumentManager.getInstance().saveDocument(document);
+    }
     String name = file.getName();
     try {
       VirtualFile userFile = toDir.findChild(name);