]> git.eshelyaron.com Git - emacs.git/commitdiff
Introduce and use eglot--{}, the empty json object
authorVladimir Panteleev <git@thecybershadow.net>
Tue, 19 Nov 2019 02:04:43 +0000 (02:04 +0000)
committerFelicián Németh <felician.nemeth@gmail.com>
Mon, 13 Jan 2020 15:55:23 +0000 (16:55 +0100)
* 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

lisp/progmodes/eglot.el

index 1bdca12642dd77170e2488f6b687984fd9feb5da..7f506c8c9ffdcef9fdfe0dc85e35c03a95257c55 100644 (file)
@@ -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.")
+
 
 \f
 ;;; 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