Skip to content

Commit

Permalink
Close #315: introduce and use eglot--{}, the empty JSON object
Browse files Browse the repository at this point in the history
* eglot.el (Constants): Add eglot--{}.
(eglot-shutdown, eglot--connect): Use it.

Copyright-paperwork-exempt: yes

#315: joaotavora/eglot#315
  • Loading branch information
CyberShadow authored and nemethf committed Jan 13, 2020
1 parent 24495c3 commit 8d52310
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lisp/progmodes/eglot.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)))))
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8d52310

Please sign in to comment.