]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve jrpc.el's doc (and change jrpc-request's protocol a tiny bit)
authorJoão Távora <joaotavora@gmail.com>
Fri, 18 May 2018 11:35:36 +0000 (12:35 +0100)
committerJoão Távora <joaotavora@gmail.com>
Fri, 18 May 2018 13:21:08 +0000 (14:21 +0100)
* 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

index b820ddeae5cf3ced6d3bf5e9230a9695455c5eeb..4e02c72e3e72aa2f0f8ca35a277f72861fff0ea7 100644 (file)
@@ -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)