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

Opening devtools fails because of deprecated pub global run devtools command #144

Open
Walheimat opened this issue Feb 7, 2022 · 2 comments

Comments

@Walheimat
Copy link

Describe the bug

Command lsp-dart-open-devtools runs the following:

 (let* ((pub (lsp-dart-pub-command))
           (proc (start-process "Start DevTools"
                                lsp-dart-devtools--buffer-name
                                pub "global" "run" "devtools"
                                "--machine"
                                "--enable-notifications"
                                "--try-ports" "10")))
                                ...

The problem seemingly is that pub global run devtools is deprecated, but then attempts are made to parse the JSON that will appear on the following line after the deprecation warning.

If I replace this call with "dart devtools" instead (because I previously ran dart pub global activate devtools), it works.

To Reproduce

Run the command using Dart SDK 2.15.1. You can also just run it from the terminal and you should get the output:

The top level `pub` command is deprecated. Use `dart pub` instead.

Expected behavior

Maybe the function could discard deprecation warnings, or the version of the SDK is checked to make sure no deprecation warning is encountered.

Version

[LSP Dart] 1.21.0 at 2022.02.07 @ Emacs 28.0.60
[Dart SDK] Dart SDK version: 2.15.1 (stable) (Tue Dec 14 13:32:21 2021 +0100) on "linux_x64"

[Flutter SDK] /home/krister/snap/flutter/common/flutter
[Flutter project] true
@Walheimat
Copy link
Author

Following the suggestion of the deprecation warning, dart pub global run devtools also works.

@ericdallo
Copy link
Member

thanks, we should probably check the version and use the new command

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