Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support auto-save without hot reloading on every change #3033

Closed
DanTup opened this issue Dec 27, 2020 · 7 comments
Closed

Support auto-save without hot reloading on every change #3033

DanTup opened this issue Dec 27, 2020 · 7 comments
Labels
in debugger Relates to the debug adapter or process of launching a debug session in flutter Relates to running Flutter apps is enhancement
Milestone

Comments

@DanTup
Copy link
Member

DanTup commented Dec 27, 2020

See https://stackoverflow.com/questions/65442649/visual-studio-code-auto-hot-reload-file-changes. Seems like the same as #1427 for hot-reload-on-save. It might be desirable to have this, so it may need a setting to control. To avoid it, we can examine the save reason (similar to the pub get version). It won't work if using the FS watcher though.

@DanTup DanTup added is enhancement in flutter Relates to running Flutter apps in debugger Relates to the debug adapter or process of launching a debug session labels Dec 27, 2020
@DanTup DanTup added this to the v3.19.0 milestone Dec 27, 2020
@DanTup DanTup closed this as completed in 01ed183 Jan 20, 2021
@alx-xlx
Copy link

alx-xlx commented May 8, 2022

How exactly will this work ?

@DanTup
Copy link
Member Author

DanTup commented May 8, 2022

This behaviour is controlled by the dart.hotReloadOnSave setting (it's changed slightly since this original implementation). When set to "manual", hot-reload-on-save will only trigger for manual saves (not for VS code auto-saves). You can still press Save to manually save (and trigger the reload) even when using auto-save. If set to "always", then hot reload will run for all saves, including those that were triggered automatically by VS Code's auto-save.

@alx-xlx
Copy link

alx-xlx commented May 8, 2022

I have set it to "always" but still it doesn't hot reload upon saving file changes

@DanTup
Copy link
Member Author

DanTup commented May 19, 2022

@alx-xlx are you running your app through the Run menu or with flutter run in the terminal? The reload can only work when using the VS Code debugger.

If you are using that, could you file a new issue about this, and include you exact versions of VS Code, the extensions, Flutter SDK? Thanks!

@Taro-Naza
Copy link

@alx-xlx are you running your app through the Run menu or with flutter run in the terminal? The reload can only work when using the VS Code debugger.

If you are using that, could you file a new issue about this, and include you exact versions of VS Code, the extensions, Flutter SDK? Thanks!

It would be great if we can have hot-reload when running the app using flutter run

@DanTup
Copy link
Member Author

DanTup commented Nov 28, 2022

@Taro-Naza

It would be great if we can have hot-reload when running the app using flutter run

Unfortunately this isn't possible. When you run from the terminal, the VS Code extension knows nothing about that process and cannot interact with it. You need to run from within VS Code using the Run menu (and related features) if you want to use the other features.

If there's a reason you're using flutter run and not using the commands in the terminal editor, I'd be interested to understand that. My goal is that running from the editor (which is usually as simple as pressing F5, although may require a launch.json if you need to pass additional args) is always the best option, so if there are cases where it's worse hopefully they can be improved.

@Taro-Naza
Copy link

@Taro-Naza

It would be great if we can have hot-reload when running the app using flutter run

Unfortunately this isn't possible. When you run from the terminal, the VS Code extension knows nothing about that process and cannot interact with it. You need to run from within VS Code using the Run menu (and related features) if you want to use the other features.

If there's a reason you're using flutter run and not using the commands in the terminal, I'd be interested to understand that. My goal is that running from the editor (which is usually as simple as pressing F5, although may require a launch.json if you need to pass additional args) is always the best option, so if there are cases where it's worse hopefully they can be improved.

No, I don't have a particular reason to run the app using flutter run, I'm new to mobile app development using flutter and I'm just exploring the ecosystem and the tooling available. Thank you for the response and the explanation 🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in debugger Relates to the debug adapter or process of launching a debug session in flutter Relates to running Flutter apps is enhancement
Projects
None yet
Development

No branches or pull requests

3 participants