[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot 71b9796a7a 1/2: Per #590: Add eglot-show-configur
From: |
ELPA Syncer |
Subject: |
[elpa] externals/eglot 71b9796a7a 1/2: Per #590: Add eglot-show-configuration to debug workspace configurations |
Date: |
Fri, 16 Sep 2022 21:57:36 -0400 (EDT) |
branch: externals/eglot
commit 71b9796a7adb3caba1b20b8263afa8a8b45c811e
Author: Fredrik Bergroth <fbergroth@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
Per #590: Add eglot-show-configuration to debug workspace configurations
Also see #790, #1033.
---
eglot.el | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/eglot.el b/eglot.el
index e399b29f09..91733a8d7a 100644
--- a/eglot.el
+++ b/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)