lsp-dart icon indicating copy to clipboard operation
lsp-dart copied to clipboard

Opening devtools fails because of deprecated `pub global run devtools` command

Open Walheimat opened this issue 3 years ago • 2 comments

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 avatar Feb 07 '22 18:02 Walheimat

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

Walheimat avatar Feb 07 '22 18:02 Walheimat

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

ericdallo avatar Feb 07 '22 21:02 ericdallo