emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/eglot2emacs 51ae66b50c 099/120: Add eglot-show-configuration to


From: João Távora
Subject: feature/eglot2emacs 51ae66b50c 099/120: Add eglot-show-configuration to debug workspace configurations
Date: Thu, 20 Oct 2022 07:17:06 -0400 (EDT)

branch: feature/eglot2emacs
commit 51ae66b50c9f73956039fddba72dbd7213926622
Author: Fredrik Bergroth <fbergroth@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    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
---
 lisp/progmodes/eglot.el | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index e399b29f09..91733a8d7a 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]