diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml
index ccc11336..b6d67b49 100644
--- a/META-INF/plugin.xml
+++ b/META-INF/plugin.xml
@@ -13,6 +13,7 @@
- PlantUml library upgrade to v1.2020.7
- Render URL links fix
+ - Remember file extension in export dialog
2.23
diff --git a/src/org/plantuml/idea/action/AbstractSaveDiagramAction.java b/src/org/plantuml/idea/action/AbstractSaveDiagramAction.java
index 25d994bb..ac3e2471 100644
--- a/src/org/plantuml/idea/action/AbstractSaveDiagramAction.java
+++ b/src/org/plantuml/idea/action/AbstractSaveDiagramAction.java
@@ -19,6 +19,7 @@
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileWrapper;
+import com.intellij.util.ArrayUtil;
import com.intellij.util.PathUtilRt;
import org.apache.commons.lang.StringUtils;
import org.jetbrains.annotations.NotNull;
@@ -102,7 +103,7 @@ public void actionPerformed(@NotNull AnActionEvent e) {
lastDir = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(parentDir);
logger.info("lastDir set to " + lastDir);
}
-
+
String[] tokens = file.getAbsolutePath().split("\\.(?=[^\\.]+$)");
String base = tokens[0];
String extension;
@@ -113,7 +114,13 @@ public void actionPerformed(@NotNull AnActionEvent e) {
} else {
extension = tokens[1];
}
-
+ for (int i = 0; i < extensions.length; i++) {
+ String s = extensions[i];
+ if (s.equals(extension)) {
+ ArrayUtil.swap(extensions, 0, i);
+ break;
+ }
+ }
PlantUml.ImageFormat imageFormat;
try {