mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Jsonrpc: rework fix for bug#60088
Try to decouple receiving text and processing messages in the event loop. This should allow for requests within requests in both Eglot and the Dape extension (https://github.com/svaante/dape). jsonrpc-connection-receive is now called from timers after the process filter finished. Because of this, a detail is that any serialization errors are now thrown from timers instead of the synchronous process filter, and there's no good way to test this in ert, so a test has been deleted. * lisp/jsonrpc.el (jsonrpc--process-filter): Rework. * test/lisp/jsonrpc-tests.el (json-el-cant-serialize-this): Delete test.
This commit is contained in:
parent
d2f95ea44c
commit
60473c4d90
2 changed files with 32 additions and 42 deletions
|
|
@ -103,6 +103,7 @@
|
|||
(process-get listen-server 'handlers))))))))
|
||||
|
||||
(cl-defmacro jsonrpc--with-emacsrpc-fixture ((endpoint-sym) &body body)
|
||||
(declare (indent 1))
|
||||
`(jsonrpc--call-with-emacsrpc-fixture (lambda (,endpoint-sym) ,@body)))
|
||||
|
||||
(ert-deftest returns-3 ()
|
||||
|
|
@ -151,14 +152,6 @@
|
|||
[1 2 3 3 4 5]
|
||||
(jsonrpc-request conn 'vconcat [[1 2 3] [3 4 5]])))))
|
||||
|
||||
(ert-deftest json-el-cant-serialize-this ()
|
||||
"Can't serialize a response that is half-vector/half-list."
|
||||
(jsonrpc--with-emacsrpc-fixture (conn)
|
||||
(should-error
|
||||
;; (append [1 2 3] [3 4 5]) => (1 2 3 . [3 4 5]), which can't be
|
||||
;; serialized
|
||||
(jsonrpc-request conn 'append [[1 2 3] [3 4 5]]))))
|
||||
|
||||
(cl-defmethod jsonrpc-connection-ready-p
|
||||
((conn jsonrpc--test-client) what)
|
||||
(and (cl-call-next-method)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue