PsiDirectory.copyFileFrom -> Redo recreate file without content
已回答
I use PsiDirectory.copyFileFrom to copy file. It works fine. Undo works fine too, but redo create empty file.
Version: CE 163.12024
请先登录再写评论。
Same issue with Undo. I use command inside dialog, then close it and use Undo. Can command lose file content after closing dialog? Also Ctrl+Z don't available in dialog, it unlocks after closing dialog only.
Command looks like:
More details:
https://github.com/CeH9/PackageTemplates/blob/master/src/core/actions/custom/CopyFileAction.java#L44 - PSI method usage
https://github.com/CeH9/PackageTemplates/blob/master/src/core/actions/executor/ActionExecutor.java#L46 - Command
Arsen, there is a known issue with Undo that doesn't support binary files IDEA-99788. Do you have the same problem?
Yes, but i'm working with .json / .java / .etc text files, not binary. Is it possible to make something like "create empty file + Editor command insert full text", should it work with Undo?
Should be possible via VirtualDirectory.createChildData/VfsUtil#saveText