"safe write" "feature" in IntelliJ prevents auto-reloading of namespace depending on changed HTML
cemerick opened this issue · 0 comments
IntelliJ has a "feature" called "safe write", on by default; quoting from that link:
If this check box is selected, a changed file is first saved in a temporary file. If the save operation succeeds, the file being saved is replaced with the saved file. (Technically, the original file is deleted and the temporary file is renamed.)
Perhaps this strategy is useful in a network storage scenario, but it's a nightmare for any kind of watch service like net.cgrand.reload
. I found namespace reloading to be very sporadic until I tweaked its watch code to discover it was being triggered by e.g. resources/public/index.html___jb_tmp___
(jb_tmp being "JetBrains temp", I presume), instead of resources/public/index.html
. This finally led me to discover and disable the IDE setting, whereupon my enlive templates are always being reloaded in my dev environment. 😁
Many other people have run into problems rooted in the "safe write" option; disabling it is the universal solution/workaround:
- ckeditor/ckeditor5#154
- https://stackoverflow.com/questions/33815074/what-is-the-advantage-of-safe-write-in-jetbrains-intellij
- https://stackoverflow.com/questions/23864827/jb-bak-and-jb-old-files-in-pycharm
There are ways that net.cgrand.reload
could avoid this kind of problem, but they'd require some significant surgery (e.g. having a watcher per file "dependency" instead of on the directory, or not closing and restarting the watch service thus opening the blind spot window within which the temp file is moved over). Just turning off the (IMO questionable) "safe write" feature seems like reasonable advice in this case. So, this is fundamentally an informational issue submission; do with it as you will. 😄