From: Vladimir Panteleev Date: Tue, 19 Nov 2019 02:04:43 +0000 (+0000) Subject: Introduce and use eglot--{}, the empty json object X-Git-Tag: emacs-29.0.90~1616^2~524^2~4^2~252 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f6a72c5541f3e1564476109a06f3899f5a663882;p=emacs.git Introduce and use eglot--{}, the empty json object * eglot.el (Constants): Add eglot--{}. (eglot-shutdown, eglot--connect): Use it. Copyright-paperwork-exempt: yes GitHub-reference: close https://github.com/joaotavora/eglot/issues/315 --- diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 1bdca12642d..7f506c8c9ff 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -220,6 +220,8 @@ let the buffer grow forever." (13 . "Enum") (14 . "Keyword") (15 . "Snippet") (16 . "Color") (17 . "File") (18 . "Reference"))) +(defconst eglot--{} (make-hash-table) "The empty JSON object.") + ;;; Message verification helpers @@ -595,9 +597,9 @@ SERVER. ." (unwind-protect (progn (setf (eglot--shutdown-requested server) t) - (jsonrpc-request server :shutdown (make-hash-table) + (jsonrpc-request server :shutdown eglot--{} :timeout (or timeout 1.5)) - (jsonrpc-notify server :exit (make-hash-table))) + (jsonrpc-notify server :exit eglot--{})) ;; Now ask jsonrpc.el to shut down the server. (jsonrpc-shutdown server (not preserve-buffers)) (unless preserve-buffers (kill-buffer (jsonrpc-events-buffer server))))) @@ -874,7 +876,7 @@ This docstring appeases checkdoc, that's all." (gethash project eglot--servers-by-project)) (setf (eglot--capabilities server) capabilities) (setf (eglot--server-info server) serverInfo) - (jsonrpc-notify server :initialized (make-hash-table)) + (jsonrpc-notify server :initialized eglot--{}) (dolist (buffer (buffer-list)) (with-current-buffer buffer ;; No need to pass SERVER as an argument: it has