-
Notifications
You must be signed in to change notification settings - Fork 283
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
VSCode Hot reload #129
Comments
When running
With this Observatory url, follow the FDE/Debugging.md ~Attaching instructions. I'm not a VSCode user; please let me know if the above instructions are still correct. |
Yes that works, thank you. |
note that the observatory seems to expect you to have a |
any update on this? vscode support is for forcing me to use flutter's native solution for now |
To have hot-reload in vs-code you must:
Edit: davidmartos explained how to configure vscode so that it works without an observatoryURL. #129 (comment) |
There's a beta of the upcoming VS Code release that adds support for setting |
@DanTup @Drakirus Any chance extension can hook up debugger also? |
@JasCodes I'm not sure I understand the question. The Dart/Flutter extensions to fully support debugging for launched and attached apps, however I'm not familiar with the setup here with Go. What is it that doesn't work for you? If you raise an issue at Dart-Code with details and a log file I can take a look. |
@DanTup Check out direction for hot-reloading of this project in vscode by @Drakirus above in this thread. I am attaching it below. go-flutter generates Observatory url that one need to attach to manually for debugging.
|
Oh, sorry, you're asking for a way to automatically attach? I'm not familiar with how you're launching the app so I don't know how easy it'd be. I presume you're using the standard Go extension in VS Code to launch the Go app, and then attaching the Dart debugger? You would probably need a VS Code extension that understands how both of these work and can glue them together. |
@JasCodes you're leadin' us around in circles... The extension made by @DanTup works in 2 modes: go-flutter isn't part of the flutter tool-chain, we came up with
The steps:
Are require to connect VScode to the 'go-flutter' instance, and it allows you to have |
@Drakirus Yup I have tried and it works well.
Gotcha |
@Drakirus Proposal: how about making hover save the last observatory URI in a hidden file? I have been looking into VS Code extensions and it would not be hard to make one that reads the URI from a file and automatically attaches with the Dart VS Code extension debugger. |
I don't know the details of how |
@DanTup I was kinna thinking along same line, I was taken a back lil when @Drakirus put it like |
To be fair, if this project doesn't already have a VS Code extension, then I'm not sure it can really support this. It would need to be built as a VS Code extension specifically to glue the two things together - and I think that would work better if done by having it launch Hover and read the output than writing to a file (since it would all be streamlined into a single button press). |
I think @Drakirus meant support for the existing flutter launch extension?? As @davidmartos96 and @DanTup propose, I think nothing holds us back from creating a hover extension for vscode, basically just a GUI arround the hover cli. |
Exactly, the existing flutter/dart extension cannot support hover at the moment.
The hover VSCode extension would only be glue. For now, I don't see any value in creating our extension to support launch mode. |
I prefer to use terminal as well. That said, lots of people like the GUI buttons, so it would be awesome if a glue-like extension is made. Anyone, feel free to pick this up! 🚀 |
Is anyone else getting I am using the Dart extension version 3.3.0 Beta 3 |
I ended up finding a way to debug Go-Flutter apps within VSCode in the latest beta version v1.10.7 Flutter Setup1. Enable flutter desktop support (https://github.com/flutter/flutter/wiki/Desktop-shells#tooling)
2. Use your desktop as a device without being in master branchIf you are not in the master branch and do In your flutter installation directory with beta branch installed:
The commit checked out for the beta branch v1.10.7 should be 3. Verify your desktop is detected as a device
VSCode Setup1. New task in
|
@davidmartos96 thanks for sharing, this is absolutely amazing. 👍 |
@davidmartos96 thanks for sharing. I followed the step above. 12:49:13 › flutter devices
1 connected device:
macOS • macOS • darwin-x64 • Mac OS X 10.14.6 18G1012 But VSCode dose not detect any device. And when I try to run go-flutter apps from VSCode, it requires me to start a device. Here are my VSCode json files {
"version": "2.0.0",
"tasks": [
{
"label": "hover build darwin",
"type": "shell",
"command": "cd example && hover build darwin --debug",
"problemMatcher": [
"$go"
]
}
]
} launch.json {
"version": "0.2.1",
"configurations": [
{
"name": "Flutter Desktop App",
"type": "dart",
"request": "launch",
"program": "example/lib/main_desktop.dart",
"args": ["--use-application-binary", "go/build/outputs/darwin/fijkplayer_example"],
"preLaunchTask": "hover build darwin"
}
]
} settings.json {
"dart.env": {
"ENABLE_FLUTTER_DESKTOP": true,
}
} |
@befovy If launching flutter devices from the console works, then make sure that VSCode is using the same flutter binary as your PATH. Also, restart VSCode so that it refreshes the available devices. Another thing you can try is to remove the dart.env settings, that step is not necessary anymore for Flutter desktop. Now you can set it up with |
If you run If neither of these seem to explain it, please file an issue at https://github.com/Dart-Code/Dart-Code and include a Flutter device daemon log file and we can debug further. |
Thanks for your answers @DanTup @davidmartos96
After I created an empty But I got another error when running go-flutter examples pointer_demo ( press F5 ). Capture log[上午10:35:02] [General] [Info] Converted program to absolute path: /Users/bai/Flutter/go-flutter-examples/pointer_demo/lib/main_desktop.dart |
Sorry I wasn't very clear with this - it can't be an empty folder, it needs to contain the macOS parts of the app. For example if you run |
@DanTup Since the goal is just to pass the Flutter daemon's check that the project supports the desktop platform, an empty folder should work, as that's all the daemon checks (currently, although there's no guarantee that won't change in the future). The build for go-flutter doesn't use the Flutter desktop embedding or runner. That error just looks like the result of supplying a binary, rather than the .app, as the prebuilt path on macOS. |
Ah - it didn't occur to me this might work differently - thanks for clarifying! :-) |
I think it awesome if |
@chengxuncc I'm not 100% sure hover is the right place for baking such functionality. Hot reload is trigger when the My opinion is, the editor should implement such feature, not hover. Because it has a much better understanding of what is modified or not. Here is my POC (obtaining the
|
For anyone still interested, I made a fork of hover where I added |
@Nohac please open a PR on hover, discussion about this feature can properly take place in the PR. |
Has anything happened regarding the PR? (Here is the change, by the way) |
@solarkraft Sadly, no. I use neovim + https://github.com/iamcco/coc-flutter that recently got support for go-flutter: iamcco/coc-flutter@02238b2 so I personally don't need the file watcher anymore. Feel free to take my changes and open a PR if you want 👍 |
Now that it is possible to get automatic hot reload working using https://github.com/google/flutter-desktop-embedding and vscode is there a way now to get it working with hover?
The text was updated successfully, but these errors were encountered: