emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/eglot cc5c8fca8c 2/3: Add half-baked M-x eglot-list-con


From: ELPA Syncer
Subject: [elpa] externals/eglot cc5c8fca8c 2/3: Add half-baked M-x eglot-list-connections
Date: Wed, 5 Oct 2022 15:57:40 -0400 (EDT)

branch: externals/eglot
commit cc5c8fca8cb29267bda19dac3d005937da63e6ce
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Add half-baked M-x eglot-list-connections
    
    Not very useful for now, but more functionality could be added later,
    like bindings for disconnecting a given connection, switching to its
    events buffers, or just listing some details like capabilities.
    
    * eglot.el (eglot-list-connections-mode, eglot-list-connections):
    New mode and function.
---
 eglot.el | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/eglot.el b/eglot.el
index 010f8c86c7..918bba6210 100644
--- a/eglot.el
+++ b/eglot.el
@@ -3317,6 +3317,40 @@ If NOERROR, return predicate, else erroring function."
   `(,self () (re-search-forward ,(concat "\\=" arg)) (,next)))
 
 
+;;; List connections mode
+
+(define-derived-mode eglot-list-connections-mode  tabulated-list-mode
+  "" "Eglot Connection List Mode
+
+\\{sly-connection-list-mode-map}"
+  (setq-local tabulated-list-format
+              `[("Language server" 16) ("Project name" 16) ("Modes handled" 
16)])
+  (tabulated-list-init-header))
+
+(defun eglot-list-connections ()
+  "List currently active Eglot connections."
+  (interactive)
+  (with-current-buffer
+      (get-buffer-create "*EGLOT connections*")
+    (let ((inhibit-read-only t))
+      (erase-buffer)
+      (eglot-list-connections-mode)
+      (setq-local tabulated-list-entries
+                  (mapcar
+                   (lambda (server)
+                     (list server
+                           `[,(or (plist-get (eglot--server-info server) :name)
+                                  (jsonrpc-name server))
+                             ,(eglot-project-nickname server)
+                             ,(mapconcat #'symbol-name
+                                         (eglot--major-modes server)
+                                         ", ")]))
+                   (cl-reduce #'append
+                              (hash-table-values eglot--servers-by-project))))
+      (revert-buffer)
+      (pop-to-buffer (current-buffer)))))
+
+
 ;;; Hacks
 ;;;
 ;; FIXME: Although desktop.el compatibility is Emacs bug#56407, the



reply via email to

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