skaffold icon indicating copy to clipboard operation
skaffold copied to clipboard

File change detection is unreliable when coding with IntelliJ/GoLand

Open dgageot opened this issue 8 years ago • 6 comments

When using IntelliJ/Goland, after a few changes, no file changes are detected anymore. Even outside of the IDE. Looks like it breaks silently.

dgageot avatar Mar 31 '18 09:03 dgageot

When a change is made with VSCode, the watch code receives this event:

CHANGE notify.Write: "/Users/dgageot/go/src/github.com/GoogleCloudPlatform/skaffold/examples/getting-started/main.go"

Same change in IntelliJ:

CHANGE notify.Rename: "/Users/dgageot/go/src/github.com/GoogleCloudPlatform/skaffold/examples/getting-started/main.go"

Or sometimes:

CHANGE notify.Rename|notify.Remove: "/Users/dgageot/go/src/github.com/GoogleCloudPlatform/skaffold/examples/getting-started/main.go"

It looks like IntelliJ doesn't do straight writes to file and that messes with the file watcher.

dgageot avatar Mar 31 '18 10:03 dgageot

OK. So the library we are using to track file changes removes a file from the watch list if this file is removed/renamed. IntelliJ does rename the file when it's saved. We need to find a better way of using the library or a better library.

dgageot avatar Mar 31 '18 12:03 dgageot

I've tried 3 fsnotify libraries. None of them support deleting and then recreating files. One way to fix that is to watch parent folders for file creation. It'll make the code way more complicated

dgageot avatar Mar 31 '18 16:03 dgageot

This is also happening for PHPStorm as reported on twitter

https://twitter.com/gortron/status/980822889728479232

r2d4 avatar Apr 03 '18 16:04 r2d4

I think this may be related to a setting that is called "Use safe write (save changes to a temporary file first)". I haven't run into this issue since turning that setting off.

viglesiasce avatar Apr 04 '18 18:04 viglesiasce

I might be related to something different altogether I used this solution from the git side and it worked like magic https://stackoverflow.com/questions/1580596/how-do-i-make-git-ignore-file-mode-chmod-changes git config core.fileMode false

itamarlev avatar Oct 08 '20 18:10 itamarlev