Skip to content

Commit

Permalink
Per #590: Add eglot-show-configuration to debug workspace configurations
Browse files Browse the repository at this point in the history
Also see #790, #1033.

#590: joaotavora/eglot#590
#790: joaotavora/eglot#790
#1033: joaotavora/eglot#1033
  • Loading branch information
fbergroth authored and joaotavora committed Sep 17, 2022
1 parent 2aadf5d commit 66ce68b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lisp/progmodes/eglot.el
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
(require 'filenotify)
(require 'ert)
(require 'array)
(require 'json)

;; ElDoc is preloaded in Emacs, so `require'-ing won't guarantee we are
;; using the latest version from GNU Elpa when we load eglot.el. Use an
Expand Down Expand Up @@ -2210,6 +2211,18 @@ above.")
;;;###autoload
(put 'eglot-workspace-configuration 'safe-local-variable 'listp)

(defun eglot-show-configuration (server)
"Dump `eglot-workspace-configuration' as json for debugging."
(interactive (list (eglot--read-server "Server configuration"
(eglot-current-server))))
(let ((conf (eglot--workspace-configuration server)))
(with-current-buffer (get-buffer-create " *eglot configuration*")
(erase-buffer)
(insert (jsonrpc--json-encode conf))
(json-mode)
(json-pretty-print-buffer)
(pop-to-buffer (current-buffer)))))

(defun eglot--workspace-configuration (server)
(if (functionp eglot-workspace-configuration)
(funcall eglot-workspace-configuration server)
Expand Down

0 comments on commit 66ce68b

Please sign in to comment.