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

VSCode Hot reload #129

Closed
kingwill101 opened this issue May 3, 2019 · 36 comments
Closed

VSCode Hot reload #129

kingwill101 opened this issue May 3, 2019 · 36 comments
Labels
hover question User questions

Comments

@kingwill101
Copy link

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?

@pchampio
Copy link
Member

pchampio commented May 3, 2019

When running hover run you should get a line:

[...]
flutter: Observatory listening on http://127.0.0.1:50300/xzxoXvGyLX0=/
[...]

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.

@kingwill101
Copy link
Author

Yes that works, thank you.

@pchampio pchampio closed this as completed May 3, 2019
@kingwill101
Copy link
Author

note that the observatory seems to expect you to have a main.dart file when reloading

@JasCodes
Copy link

any update on this? vscode support is for forcing me to use flutter's native solution for now

@pchampio
Copy link
Member

pchampio commented Jul 21, 2019

To have hot-reload in vs-code you must:

  • Get the 'Observatory url'.
    When running hover run you should get a line:
    [...]
    flutter: Observatory listening on http://127.0.0.1:50300/xzxoXvGyLX0=/
    [...]
    
    It's to this Observatory that the VSCode extension will connect to.
  • Add a VSCode launch configuration like the following:
    {
      "name": "go-flutter desktop",
      "request": "attach",
      "deviceId": "flutter-tester",
      "observatoryUri": "${command:dart.promptForVmService}",
      "type": "dart",
      "program": "lib/main_desktop.dart" // Dart-Code v3.3.0 required
    }
    
  • Start Debugging (F5)
  • Paste in the popup prompt the 'Observatory url'
  • Enjoy hot-reloading and the other feature that the VSCode extension provide!

Edit: davidmartos explained how to configure vscode so that it works without an observatoryURL. #129 (comment)

@DanTup
Copy link

DanTup commented Jul 22, 2019

There's a beta of the upcoming VS Code release that adds support for setting "program": on attach configs here:

Dart-Code/Dart-Code#1881 (comment)

@JasCodes
Copy link

@DanTup @Drakirus Any chance extension can hook up debugger also?

@DanTup
Copy link

DanTup commented Jul 23, 2019

@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.

@JasCodes
Copy link

@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.

To have hot-reload in vs-code you have to:

  • Use lib/main.dart as your app entry-point.
    hover default the entry-point to lib/main_desktop.dart, it's not supported by VSCode, Dart-Code/Dart-Code#1881, in order to get hover run with VSCode you have to run: hover run --target=lib/main.dart. (cough: don't forget the debugDefaultTargetPlatformOverride in main.dart wink)

  • Get the 'Observatory url'.
    When running hover run you should get a line:

    [...]
    flutter: Observatory listening on http://127.0.0.1:50300/xzxoXvGyLX0=/
    [...]
    

    It's to this Observatory that the VSCode extension well connect to.

  • Add a VSCode launch configuration like the following:

    {
      "name": "go-flutter desktop",
      "request": "attach",
      "deviceId": "flutter-tester",
      "observatoryUri": "${command:dart.promptForVmService}",
      "type": "dart",
      "program": "lib/main_desktop.dart" // Dart-Code v3.3.0 required
    }
    
  • Start Debugging (F5)

  • Paste in the popup prompt the 'Observatory url'

  • Enjoy hot-reloading and the other feature that the VSCode extension provide!

@DanTup
Copy link

DanTup commented Jul 23, 2019

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.

@pchampio
Copy link
Member

pchampio commented Jul 23, 2019

@JasCodes you're leadin' us around in circles...

The extension made by @DanTup works in 2 modes: launch and attach.
I'm sure you are familiar with the launch mode, you click a button an everything is handled for you.

go-flutter isn't part of the flutter tool-chain, we came up with hover to automate the maximum of the painful setup. We are not supporting VSCode launchmode, and will certainly never support it.

hover, when running the the hover run command mode exposes the dart VM "Observatory url" (Not generated by go-flutter, it's a dart VM feature) in which you can connect yourself to interact with.. the dart VM.

The steps:

  • Get the 'Observatory url'.
    When running hover run you should get a line:

    [...]
    flutter: Observatory listening on http://127.0.0.1:50300/xzxoXvGyLX0=/
    [...]
    

    It's to this Observatory that the VSCode extension well connect to.

  • Add a VSCode launch configuration like the following:

    {
      "name": "go-flutter desktop",
      "request": "attach",
      "deviceId": "flutter-tester",
      "observatoryUri": "${command:dart.promptForVmService}",
      "type": "dart",
      "program": "lib/main_desktop.dart" // Dart-Code v3.3.0 required
    }
    
  • Start Debugging (F5)

  • Paste in the popup prompt the 'Observatory url'

  • Enjoy hot-reloading and the other feature that the VSCode extension provide!

Are require to connect VScode to the 'go-flutter' instance, and it allows you to have fully support for debugging in VSCode, have you tried it yet?

@JasCodes
Copy link

@Drakirus Yup I have tried and it works well.

We are not supporting VSCode launchmode, and will certainly never support it.

Gotcha

@davidmartos96
Copy link
Contributor

@Drakirus Proposal: how about making hover save the last observatory URI in a hidden file?
https://github.com/go-flutter-desktop/hover/blob/4751a8e61e1d43372bf6c94639bf13e92f30bf23/cmd/run.go#L61

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.

@DanTup
Copy link

DanTup commented Jul 24, 2019

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 hover works, but you could probably also make a VS Code extension that runs it for you and regexes the URL out of stdout, then spawns a Dart debug session (here's how you can start a Dart debug session programatically - you'd want to use attach and incude the observatoryUri).

@JasCodes
Copy link

@DanTup I was kinna thinking along same line, I was taken a back lil when @Drakirus put it like We are not supporting VSCode launchmode, and will certainly never support it. That certainly shut me up 😝

@DanTup
Copy link

DanTup commented Jul 24, 2019

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).

@GeertJohan
Copy link
Member

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.

@pchampio
Copy link
Member

pchampio commented Jul 24, 2019

I think @Drakirus meant support for the existing flutter launch extension??

Exactly, the existing flutter/dart extension cannot support hover at the moment.
Nothing holds us back from creating a hover extension for VSCode, you are right. And as @DanTup said:

It would need to be built as a VS Code extension specifically to glue the two things (hover and the existing VSCode extension) together.

The hover VSCode extension would only be glue.

For now, I don't see any value in creating our extension to support launch mode.
To me, opening a terminal, executing one command and one copy-paste isn't worth automating (and time creating/maintaining such extension).

@GeertJohan
Copy link
Member

To me, opening a terminal, executing one command and one copy-paste isn't worth automating

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! 🚀

@davidmartos96
Copy link
Contributor

Is anyone else getting Error 1001 received from application: File system already exists when attaching with the configuration @Drakirus provided above?
It attaches fine, with breakpoints, but all Flutter output is missing. The Debug Console is empty.

image

I am using the Dart extension version 3.3.0 Beta 3

@pchampio pchampio changed the title Hot reload VSCode Hot reload Aug 2, 2019
@pchampio pchampio added hover question User questions labels Aug 11, 2019
@davidmartos96
Copy link
Contributor

davidmartos96 commented Nov 6, 2019

I ended up finding a way to debug Go-Flutter apps within VSCode in the latest beta version v1.10.7
without copy pasting the Observatory URL and I wanted to share it with you.

Flutter Setup

1. Enable flutter desktop support (https://github.com/flutter/flutter/wiki/Desktop-shells#tooling)

flutter config --enable-linux-desktop

2. Use your desktop as a device without being in master branch

If you are not in the master branch and do flutter devices only Android and iOS devices will appear by default. A way to change this is checking out the latest commit in the beta branch of flutter instead of checking out the beta branch itself, to let flutter think you are in master. Hopefully this step won't be required in the future, when flutter-desktop-embedding is more mature.

In your flutter installation directory with beta branch installed:

git checkout HEAD~0

The commit checked out for the beta branch v1.10.7 should be e70236e36

3. Verify your desktop is detected as a device

flutter devices

VSCode Setup

1. New task in tasks.json

{
    "label": "hover build linux",
    "type": "shell",
    "command": "hover build linux --debug",
    "problemMatcher": [
        "$go"
    ]
}

Change the command according to your desktop.

2. New launch configuration in launch.json

{
    "name": "Flutter Desktop App",
    "type": "dart",
    "request": "launch",
    "program": "lib/main_desktop.dart",
    "args": ["--use-application-binary", "go/build/outputs/linux/example_flutter"],
    "preLaunchTask": "hover build linux"
}

Change the output path accordingly to your desktop.

Debug

Place a breakpoint in your Dart code and run the new launch configuration.

Let me know if you have any questions

@pchampio
Copy link
Member

pchampio commented Nov 6, 2019

@davidmartos96 thanks for sharing, this is absolutely amazing. 👍

@befovy
Copy link
Contributor

befovy commented Nov 24, 2019

@davidmartos96 thanks for sharing. I followed the step above.
flutter device list mac os as a device.

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.
image

And when I try to run go-flutter apps from VSCode, it requires me to start a device.

image

Here are my VSCode json files
task.json

{
    "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,
    }
}

@davidmartos96
Copy link
Contributor

davidmartos96 commented Nov 24, 2019

@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 flutter config as above.

@DanTup
Copy link

DanTup commented Nov 24, 2019

If you run flutter config --enable-mac-desktop while VS Code is open, you'll need to restart it as the config changes are only read at startup (and VS Code runs the device daemon in the background). There's another potential reason for the device to not show up, and that's if there isn't a macOS desktop project in the current folder (VS Code asks the device daemon which of the devies are valid for the project in a given folder).

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.

@befovy
Copy link
Contributor

befovy commented Nov 25, 2019

Thanks for your answers @DanTup @davidmartos96

There's another potential reason for the device to not show up, and that's if there isn't a macOS desktop project in the current folder

After I created an empty macos folder in project, VS Code show the macOS device.

But I got another error when running go-flutter examples pointer_demo ( press F5 ).
BYW hover run works OK.

image

image

Capture log

[上午10:35:02] [General] [Info] Converted program to absolute path: /Users/bai/Flutter/go-flutter-examples/pointer_demo/lib/main_desktop.dart
[上午10:35:02] [General] [Info] Using workspace as cwd: /Users/bai/Flutter/go-flutter-examples/pointer_demo
[上午10:35:02] [General] [Info] Detected launch project as Flutter
[上午10:35:02] [General] [Info] Using Flutter debug adapter for this session
[上午10:35:02] [FlutterDaemon] [Info] ==> [{"id":"16","method":"daemon.getSupportedPlatforms","params":{"projectRoot":"/Users/bai/Flutter/go-flutter-examples/pointer_demo"}}]
[上午10:35:02] [FlutterDaemon] [Info] <== [{"id":"16","result":{"platforms":["macos"]}}]
[上午10:35:02] [General] [Info] Checking for errors before launching
[上午10:35:02] [General] [Info] Debug session starting...
{
"name": "Flutter Desktop App",
"type": "dart",
"request": "launch",
"program": "/Users/bai/Flutter/go-flutter-examples/pointer_demo/lib/main_desktop.dart",
"args": [
"--use-application-binary",
"go/build/outputs/darwin/pointer_demo"
],
"preLaunchTask": "hover build darwin",
"cwd": "/Users/bai/Flutter/go-flutter-examples/pointer_demo",
"vmAdditionalArgs": [],
"vmServicePort": 0,
"dartPath": "/usr/local/flutter/bin/cache/dart-sdk/bin/dart",
"maxLogLineLength": 2000,
"pubPath": "/usr/local/flutter/bin/cache/dart-sdk/bin/pub",
"pubSnapshotPath": "/usr/local/flutter/bin/cache/dart-sdk/bin/snapshots/pub.dart.snapshot",
"debugSdkLibraries": false,
"debugExternalLibraries": false,
"showDartDeveloperLogs": true,
"useFlutterStructuredErrors": true,
"debuggerHandlesPathsEverywhereForBreakpoints": true,
"evaluateGettersInDebugViews": true,
"forceFlutterVerboseMode": true,
"flutterTrackWidgetCreation": true,
"flutterMode": "debug",
"flutterPlatform": "default",
"flutterPath": "/usr/local/flutter/bin/flutter",
"deviceId": "macOS",
"deviceName": "macOS (darwin-x64)",
"showMemoryUsage": false,
"debugServer": 49494,
"debuggerType": 2
}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/flutter_assets/kernel_blob.bin"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/flutter_assets/vm_snapshot_data"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/flutter_assets/isolate_snapshot_data"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/flutter_assets/AssetManifest.json"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/flutter_assets/FontManifest.json"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/flutter_assets/LICENSE"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/flutter_assets/fonts/MaterialIcons-Regular.ttf"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/flutter_assets/fonts/Roboto/Roboto-Medium.ttf"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/flutter_assets/fonts/Roboto/Roboto-Light.ttf"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/flutter_assets/fonts/Roboto/Roboto-Regular.ttf"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/flutter_assets/fonts/Roboto/Roboto-Bold.ttf"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/flutter_assets/fonts/Roboto/Roboto-Thin.ttf"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/flutter_assets/fonts/Roboto/Roboto-Black.ttf"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/icudtl.dat"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/assets/icon.png"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/FlutterEmbedder.framework/Resources/icudtl.dat"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/FlutterEmbedder.framework/Resources/Info.plist"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/FlutterEmbedder.framework/Versions/A/Resources/icudtl.dat"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/FlutterEmbedder.framework/Versions/A/Resources/Info.plist"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/FlutterEmbedder.framework/Versions/A/FlutterEmbedder"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/FlutterEmbedder.framework/Versions/A/Headers/FlutterEmbedder.h"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/FlutterEmbedder.framework/Versions/A/Modules/module.modulemap"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/FlutterEmbedder.framework/Versions/Current/Resources/icudtl.dat"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/FlutterEmbedder.framework/Versions/Current/Resources/Info.plist"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/FlutterEmbedder.framework/Versions/Current/FlutterEmbedder"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/FlutterEmbedder.framework/Versions/Current/Headers/FlutterEmbedder.h"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/FlutterEmbedder.framework/Versions/Current/Modules/module.modulemap"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/FlutterEmbedder.framework/FlutterEmbedder"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/FlutterEmbedder.framework/Headers/FlutterEmbedder.h"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/FlutterEmbedder.framework/Modules/module.modulemap"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/pointer_demo"]}}
[上午10:35:03] [Analyzer] [Info] <== {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}}
[上午10:35:06] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/FlutterEmbedder.framework/Resources"]}}
[上午10:35:06] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/FlutterEmbedder.framework/Versions/A/FlutterEmbedder"]}}
[上午10:35:06] [Analyzer] [Info] <== {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}}
[上午10:35:06] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/FlutterEmbedder.framework/FlutterEmbedder"]}}
[上午10:35:06] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/FlutterEmbedder.framework/Headers"]}}
[上午10:35:06] [Analyzer] [Info] <== {"event":"analysis.flushResults","params":{"files":["/Users/bai/Flutter/go-flutter-examples/pointer_demo/go/build/outputs/darwin/FlutterEmbedder.framework/Modules"]}}
[上午10:35:06] [Analyzer] [Info] <== {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}}
[上午10:35:07] [General] [Warn] Did not find session d05391b2-d767-4c94-9a10-c124a431b1e5 to handle dart.launching. There were 0 sessions:
[上午10:35:07] [General] [Warn] Event will be queued and processed when the session start event fires
[上午10:35:07] [FlutterRun] [Info] Spawning /usr/local/flutter/bin/flutter with args ["run","--machine","--target","lib/main_desktop.dart","-d","macOS","--track-widget-creation","--start-paused","--use-application-binary","go/build/outputs/darwin/pointer_demo","-v"]
[上午10:35:07] [FlutterRun] [Info] .. in /Users/bai/Flutter/go-flutter-examples/pointer_demo
[上午10:35:07] [FlutterRun] [Info] PID: 53544
[上午10:35:07] [General] [Info] Processing delayed event dart.launching for session d05391b2-d767-4c94-9a10-c124a431b1e5
[上午10:35:08] [FlutterRun] [Info] <== [ +29 ms] executing: [/usr/local/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[上午10:35:08] [FlutterRun] [Info] <== [ +40 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[上午10:35:08] [FlutterRun] [Info] <== [ ] 856a90e67c9284124d44d2be6c785bacd3a1c772
[上午10:35:08] [FlutterRun] [Info] <== [ ] executing: [/usr/local/flutter/] git describe --match v*.. --first-parent --long --tags
[上午10:35:08] [FlutterRun] [Info] <== [ +21 ms] Exit code 0 from: git describe --match v*.. --first-parent --long --tags
[上午10:35:08] [FlutterRun] [Info] <== [ ] v1.11.0-0-g856a90e67
[上午10:35:08] [FlutterRun] [Info] <== [ +8 ms] executing: [/usr/local/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[上午10:35:08] [FlutterRun] [Info] <== [ +9 ms] Exit code 128 from: git rev-parse --abbrev-ref --symbolic @{u}
[上午10:35:08] [FlutterRun] [Info] <== [ ] fatal: HEAD 没有指向一个分支
[上午10:35:08] [FlutterRun] [Info] <== [ +13 ms] executing: [/usr/local/flutter/] git rev-parse --abbrev-ref HEAD
[上午10:35:08] [FlutterRun] [Info] <== [ +6 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[上午10:35:08] [FlutterRun] [Info] <== [ ] HEAD
[上午10:35:08] [FlutterRun] [Info] <== [ +28 ms] executing: /usr/bin/xcode-select --print-path
[上午10:35:08] [FlutterRun] [Info] <== [ +12 ms] Exit code 0 from: /usr/bin/xcode-select --print-path
[上午10:35:08] [FlutterRun] [Info] <== [ ] /Applications/Xcode.app/Contents/Developer
[上午10:35:08] [FlutterRun] [Info] <== [ +1 ms] executing: /usr/bin/xcodebuild -version
[上午10:35:08] [FlutterRun] [Info] <== [ +100 ms] Exit code 0 from: /usr/bin/xcodebuild -version
[上午10:35:08] [FlutterRun] [Info] <== [ +1 ms] Xcode 10.3
[上午10:35:08] [FlutterRun] [Info] <== Build version 10G8
[上午10:35:08] [FlutterRun] [Info] <== [ +66 ms] executing: /Users/bai/Library/Android/sdk/platform-tools/adb devices -l
[上午10:35:08] [FlutterRun] [Info] <== [ +8 ms] Exit code 0 from: /Users/bai/Library/Android/sdk/platform-tools/adb devices -l
[上午10:35:08] [FlutterRun] [Info] <== [ ] List of devices attached
[上午10:35:08] [FlutterRun] [Info] <== [ +21 ms] executing: /usr/local/flutter/bin/cache/artifacts/libimobiledevice/idevice_id -h
[上午10:35:08] [FlutterRun] [Info] <== [ +45 ms] /usr/bin/xcrun simctl list --json devices
[上午10:35:08] [FlutterRun] [Info] <== [ +206 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[上午10:35:08] [FlutterRun] [Info] <== [ ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[上午10:35:08] [FlutterRun] [Info] <== [ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[上午10:35:08] [FlutterRun] [Info] <== [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[上午10:35:08] [FlutterRun] [Info] <== [ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[上午10:35:08] [FlutterRun] [Info] <== [ +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[上午10:35:08] [FlutterRun] [Info] <== [ +2 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[上午10:35:08] [FlutterRun] [Info] <== [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[上午10:35:08] [FlutterRun] [Info] <== [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[上午10:35:08] [FlutterRun] [Info] <== [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[上午10:35:08] [FlutterRun] [Info] <== [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[上午10:35:08] [FlutterRun] [Info] <== [ +9 ms] executing: sw_vers -productName
[上午10:35:08] [FlutterRun] [Info] <== [ +18 ms] Exit code 0 from: sw_vers -productName
[上午10:35:08] [FlutterRun] [Info] <== [ ] Mac OS X
[上午10:35:08] [FlutterRun] [Info] <== [ ] executing: sw_vers -productVersion
[上午10:35:08] [FlutterRun] [Info] <== [ +17 ms] Exit code 0 from: sw_vers -productVersion
[上午10:35:08] [FlutterRun] [Info] <== [ ] 10.14.6
[上午10:35:08] [FlutterRun] [Info] <== [ ] executing: sw_vers -buildVersion
[上午10:35:08] [FlutterRun] [Info] <== [ +18 ms] Exit code 0 from: sw_vers -buildVersion
[上午10:35:08] [FlutterRun] [Info] <== [ ] 18G1012
[上午10:35:08] [FlutterRun] [Info] <== [{"event":"daemon.connected","params":{"version":"0.5.3","pid":61612}}]
[上午10:35:08] [FlutterRun] [Info] <== [{"event":"app.start","params":{"appId":"396b1d1e-c82c-44cb-805e-4ac30a6fb42a","deviceId":"macOS","directory":"/Users/bai/Flutter/go-flutter-examples/pointer_demo","supportsRestart":true,"launchMode":"run"}}]
[上午10:35:08] [FlutterRun] [Info] <== [ +67 ms] Launching lib/main_desktop.dart on macOS in debug mode...
[上午10:35:08] [FlutterRun] [Info] <== [{"event":"app.stop","params":{"appId":"396b1d1e-c82c-44cb-805e-4ac30a6fb42a","error":"type 'LocalFile' is not a subtype of type 'Directory' where\n File is from package:file/src/interface/file.dart\n File is from dart:io\n","trace":"#0 new MacOSApp.fromPrebuiltApp (package:flutter_tools/src/macos/application_package.dart:35:68)\n#1 ApplicationPackageFactory.getPackageForPlatform (package:flutter_tools/src/application_package.dart:58:24)\n\n#2 FlutterDevice.runHot (package:flutter_tools/src/resident_runner.dart:389:56)\n\n#3 HotRunner.run (package:flutter_tools/src/run_hot.dart:266:39)\n\n#4 AppDomain.startApp. (package:flutter_tools/src/commands/daemon.dart:468:23)\n#5 AppDomain.launch. (package:flutter_tools/src/commands/daemon.dart:530:26)\n\n#6 AppContext.run. (package:flutter_tools/src/base/context.dart:146:29)\n\n#7 _rootRun (dart:async/zone.dart:1124:13)\n#8 _CustomZone.run (dart:async/zone.dart:1021:19)\n#9 _runZoned (dart:async/zone.dart:1516:10)\n#10 runZoned (dart:async/zone.dart:1463:12)\n#11 AppContext.run (package:flutter_tools/src/base/context.dart:145:18)\n\n#12 AppInstance._runInZone (package:flutter_tools/src/commands/daemon.dart:928:20)\n#13 AppDomain.launch (package:flutter_tools/src/commands/daemon.dart:528:15)\n\n#14 AppDomain.startApp (package:flutter_tools/src/commands/daemon.dart:462:12)\n\n#15 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:347:38)\n\n#16 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:556:18)\n\n#17 FlutterCommand.run. (package:flutter_tools/src/runner/flu…
[上午10:35:08] [FlutterRun] [Info] Process terminated! null, SIGTERM
[上午10:35:08] [Observatory] [Info] Process exited (sigterm)
[上午10:35:08] [Observatory] [Info] Disconnect requested!

@DanTup
Copy link

DanTup commented Nov 25, 2019

After I created an empty macos folder in project, VS Code show the macOS device.

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 flutter create --macos in a new folder, it will include macos folder with the necessary files. I think you can probably just copy that folder over into your project, but I'm not familiar enough with the desktop work to be certain. Running flutter create . --macos in the existing project may also work.

@stuartmorgan
Copy link

stuartmorgan commented Nov 26, 2019

@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.

@DanTup
Copy link

DanTup commented Nov 26, 2019

The build for go-flutter doesn't use the Flutter desktop embedding or runner.

Ah - it didn't occur to me this might work differently - thanks for clarifying! :-)

@chengxuncc
Copy link

To me, opening a terminal, executing one command and one copy-paste isn't worth automating (and time creating/maintaining such extension).

I think it awesome if hover run is watching folder lib, detecting files changed, and auto hot-reload if detected. It can be implemented by receiving system file events, there're several Go libraries of file system notification. I would get tired of typing r in my heart.

@pchampio
Copy link
Member

pchampio commented Mar 20, 2020

@chengxuncc I'm not 100% sure hover is the right place for baking such functionality.
I've managed to create a proof-of-concept, it doesn't require any hover modification.

Hot reload is trigger when the flutter attach receives a SIG USR1 signal source.
By it's own, hover spawn a flutter attach cmd, it's on this one that we forward key-presses like r.

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 flutter attach is very ugly and, adaptation to your system is require, not all system have the same label for USR1).

$ inotifywait -q -m -e modify lib |
while read -r filename event; do
kill -USR1 $(pgrep -f "attach") && echo 'reload flutter...'
done

@ericdallo
Copy link

ericdallo commented Mar 20, 2020

I agree with @pchampio, I think this is not hover's responsibility, this should be implemented in a VSCode extension, where it calls hover in background and optionally allow to bind some keys to auto-reload like hover.el does for emacs.

@Nohac
Copy link

Nohac commented May 27, 2020

For anyone still interested, I made a fork of hover where I added hover run --watch to get hot reloading. It's just a "proof of concept", and only watches the libs folder for now (no recursive watch). It also removes the ability to press r or R in the terminal to reload without having to press Enter after.

@pchampio
Copy link
Member

@Nohac please open a PR on hover, discussion about this feature can properly take place in the PR.

@solarkraft
Copy link

Has anything happened regarding the PR? (Here is the change, by the way)

@Nohac
Copy link

Nohac commented Aug 9, 2020

@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 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hover question User questions
Development

No branches or pull requests