summaryrefslogtreecommitdiff
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorFredrik Bergroth <fbergroth@gmail.com>2022-01-10 15:09:36 +0100
committerJoão Távora <joaotavora@gmail.com>2022-09-17 01:38:03 +0100
commit51ae66b50c9f73956039fddba72dbd7213926622 (patch)
treec6da73ffcda386e1d0f4fb54f97354d24231bec0 /lisp/progmodes
parentd2e842bbf51134bfd33943247faa88db99a36842 (diff)
downloademacs-51ae66b50c9f73956039fddba72dbd7213926622.tar.gz
emacs-51ae66b50c9f73956039fddba72dbd7213926622.tar.bz2
emacs-51ae66b50c9f73956039fddba72dbd7213926622.zip
Add eglot-show-configuration to debug workspace configurations
Also see https://github.com/joaotavora/eglot/issues/790, https://github.com/joaotavora/eglot/issues/1033. GitHub-reference: per https://github.com/joaotavora/eglot/issues/590
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/eglot.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index e399b29f09f..91733a8d7a6 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -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
@@ -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)