Function: dape-request
dape-request is a natively compiled function defined in dape.el.
Signature
(dape-request CONN COMMAND ARGUMENTS &optional CB)
Documentation
Send request with COMMAND and ARGUMENTS to adapter CONN.
If callback function CB is supplied, it's called on timeout and success.
CB will be called with PLIST and ERROR. On success, ERROR will be nil. On failure, ERROR will be an string.
If dape--request-blocking is non-nil do blocking request.
Source Code
;; Defined in /nix/store/1fiaif8pifqj2jh65rbg3fkhg3i56q42-emacs-packages-deps/share/emacs/site-lisp/elpa/dape-0.27.1/dape.el
(defun dape-request (conn command arguments &optional cb)
"Send request with COMMAND and ARGUMENTS to adapter CONN.
If callback function CB is supplied, it's called on timeout
and success.
CB will be called with PLIST and ERROR.
On success, ERROR will be nil.
On failure, ERROR will be an string.
If `dape--request-blocking' is non-nil do blocking request."
(cl-flet ((success-fn (result)
(funcall cb (plist-get result :body)
(unless (eq (plist-get result :success) t)
(or (plist-get result :message)
(plist-get (plist-get (plist-get result :body)
:error)
:format)
""))))
(timeout-fn ()
(dape--warn
"Command %S timed out after %d seconds (see \
`dape-request-timeout')"
command
dape-request-timeout)
(funcall cb nil dape--timeout-error)))
(if dape--request-blocking
(let ((result (jsonrpc-request conn command arguments)))
(when cb (success-fn result)))
(jsonrpc-async-request conn command arguments
:success-fn (when cb #'success-fn)
:error-fn #'ignore ; will never be called
:timeout-fn (when cb #'timeout-fn)
:timeout dape-request-timeout))))