From 868d531c9ee06cf2ebd7f4232c148f8e414f98ef Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Fri, 18 May 2018 12:35:36 +0100 Subject: [PATCH] Improve jrpc.el's doc (and change jrpc-request's protocol a tiny bit) * jrpc.el (jrpc-async-request) (jrpc-request,jrpc-notify,jrpc-reply): Improve docstring. (jrpc-connect): Improve docstring and add autoload cookie (jrpc-request): DEFERRED param is now &key (defgroup jrpc): Fix description. * eglot.el (advice-add jrpc-request): Use &key deferred. (eglot-completion-at-point): Pass :deferred to jrpc-request --- lisp/progmodes/eglot.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index b820ddeae5c..4e02c72e3e7 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -744,11 +744,13 @@ Records START, END and PRE-CHANGE-LENGTH locally." `[(,pre-change-length ,(buffer-substring-no-properties start end))]))) -;; HACK! +;; HACK! Launching a deferred sync request with outstanding changes is a +;; bad idea, since that might lead to the request never having a +;; chance to run, because `jrpc-ready-predicates'. (advice-add #'jrpc-request :before - (lambda (_proc _method _params &optional deferred) + (cl-function (lambda (_proc _method _params &key deferred) (when (and eglot--managed-mode deferred) - (eglot--signal-textDocument/didChange)))) + (eglot--signal-textDocument/didChange))))) (defun eglot--signal-textDocument/didChange () "Send textDocument/didChange to server." @@ -937,7 +939,7 @@ DUMMY is ignored" (let* ((resp (jrpc-request proc :textDocument/completion (eglot--TextDocumentPositionParams) - :textDocument/completion)) + :deferred :textDocument/completion)) (items (if (vectorp resp) resp (plist-get resp :items)))) (mapcar (jrpc-lambda (&rest all &key label &allow-other-keys) -- 2.39.2