You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a tool that modifies .dart files in a Flutter project. It is a helper tool - VS Code would still be the primary IDE.
Right now, changes to files made by the tool are reflected in VSC, but the change does not trigger a hot-reload. This means that after making edits in the other tool, I have to hit save on a file in VSC in order to trigger the hot-reload.
Ideally, I could open a Flutter project in VS Code, start a debug session, swap over to another tool and make updates to files there, and hot-reload would trigger without having to swap back to VSC.
It wouldn't be difficult to change this - however I'm a little worried about it re-introducing issues like #1427. VS Code has an option for auto-saving and when we use to hot-reload on every one of them, it was really frustrating. So we added a long delay so if the user didn't explicitly press save, we could add a huge debounce delay.
Doing that here would mean you'd have to wait some long period before the hot reload was triggered.
I wonder if there's a better way you could do this from the tool (for ex. if you get the pid of the process - for example by using the --pid-file switch) you could send a SIGUSR1 signal:
--pid-file Specify a file to write the process id to. You can send SIGUSR1 to trigger a hot reload and SIGUSR2 to
trigger a hot restart.
I've added a new setting dart.previewHotReloadOnSaveWatcher which will switch to using a fs watcher for hot reload. It still applies a 200ms debounce to try to avoid firing too much (this means if you're writing lots of files, it'll only fire after there has been a gap of 200ms between any events).
Activity
DanTup commentedon Oct 30, 2019
It wouldn't be difficult to change this - however I'm a little worried about it re-introducing issues like #1427. VS Code has an option for auto-saving and when we use to hot-reload on every one of them, it was really frustrating. So we added a long delay so if the user didn't explicitly press save, we could add a huge debounce delay.
Doing that here would mean you'd have to wait some long period before the hot reload was triggered.
I wonder if there's a better way you could do this from the tool (for ex. if you get the pid of the process - for example by using the
--pid-fileswitch) you could send aSIGUSR1signal:Refactor hot-reload-on-save in preperation for filesystem watcher option
Add a (preview) setting to perform reload-on-fs-change
Add a (preview) setting to perform reload-on-fs-change
DanTup commentedon Nov 14, 2019
I've added a new setting
dart.previewHotReloadOnSaveWatcherwhich will switch to using a fs watcher for hot reload. It still applies a 200ms debounce to try to avoid firing too much (this means if you're writing lots of files, it'll only fire after there has been a gap of 200ms between any events).There's a build here if you'd like to try it out:
https://github.com/Dart-Code/Dart-Code/releases/tag/v3.7.0-alpha.1
gskinner commentedon Nov 14, 2019
Awesome. Thanks @DanTup - I'll give that a try.