21
21
22
22
(require 'comint )
23
23
(require 'dash )
24
- (require 'ht )
25
24
(require 'lsp-mode )
26
25
27
26
(require 'lsp-dart-protocol )
@@ -123,18 +122,17 @@ of this command."
123
122
(lsp-dart-remove-from-alist it lsp-dart-flutter-daemon-devices)
124
123
(setq lsp-dart-flutter-daemon-devices it)))
125
124
126
- (defun lsp-dart-flutter-daemon--device-added (device )
125
+ (lsp- defun lsp-dart-flutter-daemon--device-added (( device &as &FlutterDaemonDevice :id ) )
127
126
" Add DEVICE to the devices list."
128
- (-let* ((id (gethash " id" device))
129
- (device-to-add (cons id device)))
130
- (ht-set! device " is-device" t )
127
+ (-let ((device-to-add (cons id device)))
128
+ (lsp:set-flutter-daemon-device-is-device? device t )
131
129
(setq lsp-dart-flutter-daemon-devices
132
130
(lsp-dart-remove-from-alist id lsp-dart-flutter-daemon-devices))
133
131
(add-to-list 'lsp-dart-flutter-daemon-devices device-to-add)
134
132
(-when-let (listener (alist-get id lsp-dart-flutter-daemon-device-added-listeners))
135
133
(setq lsp-dart-flutter-daemon-device-added-listeners
136
134
(lsp-dart-remove-from-alist id lsp-dart-flutter-daemon-device-added-listeners))
137
- (funcall (gethash " callback " listener) device))))
135
+ (funcall (plist-get listener :callback ) device))))
138
136
139
137
(defun lsp-dart-flutter-daemon-get-devices (callback )
140
138
" Call CALLBACK with the available emulators and devices from Flutter daemon."
@@ -147,18 +145,17 @@ of this command."
147
145
(append emulators)
148
146
(funcall callback)))))
149
147
150
- (defun lsp-dart-flutter-daemon-launch (emulator callback )
151
- " Launch EMULATOR and wait for connected state and call CALLBACK."
148
+ (lsp- defun lsp-dart-flutter-daemon-launch ((device &as &FlutterDaemonDevice :id :is-device? ) callback)
149
+ " Launch DEVICE and wait for connected state and call CALLBACK."
152
150
(if lsp-dart-flutter-daemon-current-device
153
151
(funcall callback lsp-dart-flutter-daemon-current-device)
154
152
(progn
155
- (setq lsp-dart-flutter-daemon-current-device emulator)
156
- (if (gethash " is-device" emulator)
157
- (funcall callback emulator)
158
- (-let* (((&hash " id" ) emulator)
159
- (params (ht (" emulatorId" id))))
153
+ (setq lsp-dart-flutter-daemon-current-device device)
154
+ (if is-device?
155
+ (funcall callback device)
156
+ (-let* ((params (lsp-make-flutter-daemon-emulator-launch :emulator-id id)))
160
157
(add-to-list 'lsp-dart-flutter-daemon-device-added-listeners
161
- (cons id (ht ( " callback" callback) )))
158
+ (cons id (list : callback callback)))
162
159
(lsp-dart-flutter-daemon--send " emulator.launch" params callback))))))
163
160
164
161
(defun lsp-dart-flutter-daemon--reset-current-device (_session )
0 commit comments