undo(cmd+z) triggers file save intellij

Answered

So I have a file watcher that triggers on save. It formats my elm code.
But when I hit undo, the file watcher is triggered.
So basically I can't undo anything, because I only can do one undo and then the file-watcher is triggered and I only undo the formatting... and I get into infinite loop.
How say to idea not to save file when I hit undo? 

1
13 comments

Undo doesn't save files. Could it be some third-party plug-in like Save Actions?

0

Don't have that one. 

0

Please share the logs: https://intellij-support.jetbrains.com/hc/articles/207241085 (https://intellij-support.jetbrains.com/hc/articles/206869619).

Provide a short video of the problem when this option is enabled so that it's clear when the file is saved:

 

Also try disabling these options:

 

0

It triggers this file watcher:

0

I added the files:

logs-20190403-214117.zip (99 kb)
Intelli-saving-error.mov (52.2 mb)
0

Do you have automatic compilation enabled anywhere in the IDE? It could be that modification is saved by the compiler. idea.log is truncated, doesn't include any details about the plug-ins or possible settings tweaks.

0

Not to my knowledge.
But as you can see in the video, every time I do cmd+z it asks "Undo Reload From DisK?". Maybe that undo does automatic save? 

0

Could be related, I've asked responsible developer to check it.

Why do you use file watcher instead of the built-in elm plug-in feature to run the format command on file save?

0

Because I had Alpha version of elm-format and it gave this error:
```
09:57 Execution failed (exit code 1).
/usr/local/bin/elm-format --yes --elm-version=0.19 --stdin
stdout :
stderr : option --elm-version: Invalid Elm version "0.19". Supported versions are 0.16, 0.17, 0.18
elm-format-0.18 0.6.1-alpha
Usage: elm-format [INPUT] [--output FILE] [--yes] [--validate] [--stdin]
[--elm-version VERSION] [--upgrade]
Format Elm source files.
Available options:
-h,--help Show this help text
--output FILE Write output to FILE instead of overwriting the given
source file.
--yes Reply 'yes' to all automated prompts.
--validate Check if files are formatted without changing them.
--stdin Read from stdin, output to stdout.
--elm-version VERSION The Elm version of the source files being formatted.
Valid values: 0.16, 0.17, 0.18. Default: 0.18
--upgrade Upgrade o... (show balloon)
```
I now updated formatter to 0.8.1 and using the elm plugin.
But the bug is still there, that when I load from disk it reformats, therefore I can't undo.

0

I do not have this dialog at all with the above configuration, Undo works without issues. Does it help if you disable all the file watchers?

Can you share all the logs that would include the IDE startup with the list of plug-ins/options and a small sample project to reproduce it?

0

I have another file watcher that executes this script on save:

cd $1
elm-format --yes ./src/Main.elm && elm make src/Main.elm --output /dev/null && elm make ./src/Main.elm --output ../penkioproject/static/main.js && cp ./index.html ../penkioproject/static/




0

Please add $FilePath$ into the Output paths to refresh field of the file watchers.

0

That did it! Super Thanks Yous!! =) 

0

Please sign in to leave a comment.