From: João Távora Date: Fri, 18 May 2018 11:35:36 +0000 (+0100) Subject: Improve jrpc.el's doc (and change jrpc-request's protocol a tiny bit) X-Git-Tag: emacs-29.0.90~1616^2~524^2~4^2~489^2~19 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=868d531c9ee06cf2ebd7f4232c148f8e414f98ef;p=emacs.git 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 --- 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)