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

Dart DevTools needs to be activated with 'pub global activate devtools' #212

Open
mustaqimM opened this issue Mar 2, 2024 · 1 comment

Comments

@mustaqimM
Copy link

Describe the bug
Hi there, I launched an app with lsp-dart-run and then attempted to open DevTools with lsp-dart-open-devtools.

I can't seem to run lsp-dart-open-devtools; when running lsp-dart-run, it doesn't expose the local URL to access it. (eg. http://127.0.0.1:42277/7ExjleCaLVU=/). Am I doing something wrong?

According to this issue flutter/devtools/issues/6550: flutter pub global activate devtools is deprecated; which is how lsp-dart-devtools--start attempts to start DevTools. And it should be run as dart devtools instead.

Running flutter run directly exposes DevTools and the URL. I don't know how it's meant to be when an editor runs it since lsp-dart-run doesn't show it, nor does dap-debug.

Note
Before logging the bug please make sure that the issue is reproducible with latest melpa packages.

To Reproduce

  1. Run lsp-dart-run (or dap-debug)
  2. lsp-dart-open-devtools

Expected behavior
lsp-dart-run should expose the VM Service URL. And lsp-dart-open-devtools should open DevTools and connect to the running app.

Screenshots
If applicable, add screenshots to help explain your problem.

image

Version
Include here the result of: M-x lsp-dart-version

[LSP Dart] 1.24.3 at 2024.03.02 @ Emacs 29.2
[Dart SDK] Dart SDK version: 3.3.0 (stable) (Tue Feb 13 10:25:19 2024 +0000) on "linux_x64"

[Flutter SDK] /home/mustaqim/snap/flutter/common/flutter/
[Flutter project] true
[Project entrypoint] /home/mustaqim/test_app/lib/main.dart
@DanTup
Copy link

DanTup commented Oct 9, 2024

Running flutter run directly exposes DevTools and the URL. I don't know how it's meant to be when an editor runs it

Usually, an editor will start its own version using dart devtools --machine (which starts a server and provides the URL in JSON). When running flutter run, you can pass --devtools-server-address to have Flutter reuse that existing DevTools instance. This avoids a new DevTools server being started on each debug session (for editors like VS Code, it's likely a single editor session will live across multiple debugging sessions).

As noted above, DevTools from Pub is long deprecated and shouldn't be used. Dart SDK 2.15.0 added support for dart devtools and Flutter 1.26.0 added support for the --devtools-server-address flag passed to flutter run (and to prevent dart run spawning DevTools, you can use --no-serve-devtools for dart run since Dart2.14.0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants