Skip to content

Commit 737f3f2

Browse files
committed
Improve debugger setup downloading directly from Dart-Code repo
1 parent ef28afa commit 737f3f2

File tree

3 files changed

+34
-11
lines changed

3 files changed

+34
-11
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## 1.19.0
4+
5+
* Deprecate `dap-dart-setup`, use `lsp-dart-dap-setup` now.
6+
* Improve debugger setup downloading directly from Dart-Code repo.
7+
* Bump debugger from 3.19.2 to 3.23.0.
8+
* Fix device label for web/chrome
9+
310
## 1.18.3
411

512
* Improve `lsp-dart-version` command with more details to help debug issues

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ You can disable the feature setting `lsp-dart-flutter-widget-guides` to `nil`.
113113
### Debug
114114

115115
For debugging, `lsp-dart` uses [`dap-mode`](https://github.com/emacs-lsp/dap-mode#dart).
116-
You only need to run `dap-dart-setup` one time to setup the debugger to your Emacs and `dap-debug` to start the debug.
116+
You only need to run `lsp-dart-dap-setup` one time to setup the debugger to your Emacs and `dap-debug` to start the debug.
117117

118118
![debug](images/debug.gif)
119119

lsp-dart-dap.el

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,20 @@
2929
(require 'lsp-dart-flutter-daemon)
3030
(require 'lsp-dart-devtools)
3131

32-
(defcustom lsp-dart-dap-extension-version "3.19.2"
32+
(defcustom lsp-dart-dap-extension-version "3.23.0"
3333
"The extension version."
3434
:group 'lsp-dart
3535
:type 'string)
3636

37+
(defcustom lsp-dart-dap-extension-url (format "https://github.com/Dart-Code/Dart-Code/releases/download/v%s/dart-code-%s.vsix"
38+
lsp-dart-dap-extension-version
39+
lsp-dart-dap-extension-version)
40+
"The extension url to download from."
41+
:group 'lsp-dart
42+
:type 'string)
43+
3744
(defcustom lsp-dart-dap-debugger-path
38-
(expand-file-name (concat "vscode/Dart-Code.Dart-Code/" lsp-dart-dap-extension-version)
39-
dap-utils-extension-path)
45+
(f-join dap-utils-extension-path (concat "github/Dart-Code/Dart-Code/" lsp-dart-dap-extension-version))
4046
"The path to dart vscode extension."
4147
:group 'lsp-dart
4248
:type 'string)
@@ -157,14 +163,13 @@ Required to support 'Inspect Widget'."
157163
(dap--put-if-absent conf :useFlutterStructuredErrors lsp-dart-dap-flutter-structured-errors)
158164
(lsp-dart-dap--capabilities-debugger-args conf)))
159165

160-
;; Dart
166+
(lsp-dependency
167+
'dart-debugger
168+
`(:download :url lsp-dart-dap-extension-url
169+
:decompress :zip
170+
:store-path ,(f-join lsp-dart-dap-debugger-path "dart-code")))
161171

162-
(dap-utils-vscode-setup-function
163-
"dap-dart"
164-
"Dart-Code"
165-
"Dart-Code"
166-
lsp-dart-dap-debugger-path
167-
lsp-dart-dap-extension-version)
172+
;; Dart
168173

169174
(defun lsp-dart-dap--populate-dart-start-file-args (conf)
170175
"Populate CONF with the required arguments for dart debug."
@@ -389,6 +394,17 @@ Call CALLBACK when the device is chosen and started successfully."
389394

390395
;; Public Interface
391396

397+
(defun lsp-dart-dap-setup ()
398+
"Install the Dart/Flutter debugger extension."
399+
(interactive)
400+
(lsp-package-ensure 'dart-debugger
401+
(lambda (&rest _) (lsp-dart-log "Dart debugger installed successfully!"))
402+
(lambda (e)
403+
(lsp-dart-log "Error installing Dart debugger. %s" e))))
404+
405+
(defalias 'dap-dart-setup 'lsp-dart-dap-setup)
406+
(make-obsolete 'dap-dart-setup 'lsp-dart-dap-setup "lsp-dart 1.19.0")
407+
392408
(defun lsp-dart-dap-flutter-hot-restart ()
393409
"Hot restart current Flutter debug session."
394410
(interactive)

0 commit comments

Comments
 (0)