Skip to content

Commit

Permalink
Per joaotavora/eglot#590: Add eglot-show-configuration to debug works…
Browse files Browse the repository at this point in the history
…pace configurations

Also see joaotavora/eglot#790, joaotavora/eglot#1033.
  • Loading branch information
fbergroth authored and joaotavora committed Sep 17, 2022
1 parent da873b5 commit d09b972
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions 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 d09b972

Please sign in to comment.