2424(require 'ht )
2525(require 'lsp-mode )
2626
27+ (require 'lsp-dart-protocol )
2728(require 'lsp-dart-utils )
2829
2930(defconst lsp-dart-flutter-daemon-buffer-name " *LSP Dart - Flutter daemon*" )
6667(defun lsp-dart-flutter-daemon--build-command (id method &optional params )
6768 " Build a command from an ID and METHOD.
6869PARAMS is the optional method params."
69- (let ((command (ht ( " id " id)
70- ( " method" method) )))
70+ (let ((command (lsp-make-flutter-daemon-command :id id
71+ : method method)))
7172 (when params
72- (ht- set! command " params" params))
73+ (lsp: set-flutter-daemon- command- params? command params))
7374 (concat " ["
7475 (lsp--json-serialize command)
7576 " ]\n " )))
@@ -86,22 +87,23 @@ PARAMS is the optional method params."
8687
8788(defun lsp-dart-flutter-daemon--handle-responses (raw-response )
8889 " Handle Flutter daemon response from RAW-RESPONSE."
89- (-map (-lambda ((&hash " id" " event" " result" " params" (params &as &hash? " level" " message" )))
90- (if event
91- (pcase event
90+ (-map (-lambda ((&FlutterDaemonResponse :id :event? :result?
91+ :params? (params &as &FlutterDaemonResponseParams? :level? :message? )))
92+ (if event?
93+ (pcase event?
9294 (" device.removed" (lsp-dart-flutter-daemon--device-removed params))
9395
9496 (" device.added" (lsp-dart-flutter-daemon--device-added params))
9597
96- (" daemon.logMessage" (lsp-dart-flutter-daemon--log level message)))
98+ (" daemon.logMessage" (lsp-dart-flutter-daemon--log level? message? ) ))
9799 (let* ((command (alist-get id lsp-dart-flutter-daemon-commands))
98- (callback (gethash " callback " command)))
100+ (callback (plist-get command :callback )))
99101 (when command
100102 (setq lsp-dart-flutter-daemon-commands
101103 (lsp-dart-remove-from-alist id lsp-dart-flutter-daemon-commands)))
102104 (when callback
103- (when result
104- (funcall callback result))))))
105+ (when result?
106+ (funcall callback result? ) )))))
105107 (lsp-dart-flutter-daemon--raw->response raw-response)))
106108
107109(defun lsp-dart-flutter-daemon--send (method &optional params callback )
@@ -112,7 +114,7 @@ of this command."
112114 (lsp-dart-flutter-daemon-start))
113115 (let* ((id (lsp-dart-flutter-daemon--generate-command-id))
114116 (command (lsp-dart-flutter-daemon--build-command id method params)))
115- (add-to-list 'lsp-dart-flutter-daemon-commands (cons id (ht ( " callback" callback) )))
117+ (add-to-list 'lsp-dart-flutter-daemon-commands (cons id (list : callback callback)))
116118 (comint-send-string (get-buffer-process lsp-dart-flutter-daemon-buffer-name) command)))
117119
118120(defun lsp-dart-flutter-daemon--device-removed (device )
0 commit comments