Skip to content

Commit

Permalink
fix json string being insert to curretn buffer when running `lsp-dart…
Browse files Browse the repository at this point in the history
…-run`.

Fixes #224
  • Loading branch information
ericdallo committed Nov 14, 2024
1 parent 54c6dce commit 7e3d342
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Changelog

* fix json string being insert to curretn buffer when running `lsp-dart-run`. #224

## 1.24.3

* Add `lsp-dart-dap-tools-args` to configure custom args for DAP process.
Expand Down
25 changes: 13 additions & 12 deletions lsp-dart-flutter-daemon.el
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,19 @@
&key method params &allow-other-keys)
"Implement send method to format JSON properly.
CONN ARGS METHOD PARAMS"
(when method
(plist-put args :method
(cond ((keywordp method) (substring (symbol-name method) 1))
((and method (symbolp method)) (symbol-name method))
((stringp method) method))))
(unless params
(cl-remf args :params))
(let ((json (concat "[" (jsonrpc--json-encode args) "]\r\n")))
(jsonrpc--log-event conn args 'client)
(process-send-string
(jsonrpc--process conn)
json)))
(with-temp-buffer
(when method
(plist-put args :method
(cond ((keywordp method) (substring (symbol-name method) 1))
((and method (symbolp method)) (symbol-name method))
((stringp method) method))))
(unless params
(cl-remf args :params))
(let ((json (concat "[" (jsonrpc--json-encode args) "]\r\n")))
(jsonrpc--log-event conn args 'client)
(process-send-string
(jsonrpc--process conn)
json))))

(cl-defmethod initialize-instance :after ((conn lsp-dart-flutter-daemon-connection) _slots)
"CONN."
Expand Down

0 comments on commit 7e3d342

Please sign in to comment.