From ea5c8f3930c7e6c81e9746e9676382eb000f342c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felici=C3=A1n=20N=C3=A9meth?= Date: Fri, 22 Nov 2019 18:52:00 +0100 Subject: [PATCH] Add eglot-server-name Fix #354 * eglot.el (eglot-server-name): New cl-defmethod for the base class, eglot-rls, and eglot-eclipse-jdt. (eglot--connect): Use it. --- eglot.el | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/eglot.el b/eglot.el index 6d01a972..fc4ed9a7 100644 --- a/eglot.el +++ b/eglot.el @@ -565,6 +565,11 @@ treated as in `eglot-dbind'." "Represents a server. Wraps a process for LSP communication.") +(cl-defmethod eglot-server-name (server) + "Return a friendly name describing the server." + (or (plist-get (eglot--server-info server) :name) + (jsonrpc-name server))) + ;;; Process management (defvar eglot--servers-by-project (make-hash-table :test #'equal) "Keys are projects. Values are lists of processes.") @@ -902,8 +907,7 @@ This docstring appeases checkdoc, that's all." (eglot--message "Connected! Server `%s' now managing `%s' buffers \ in project `%s'." - (or (plist-get serverInfo :name) - (jsonrpc-name server)) + (eglot-server-name server) managed-major-mode (eglot-project-nickname server)) (when tag (throw tag t)))) @@ -2565,6 +2569,11 @@ If SKIP-SIGNATURE, don't try to send textDocument/signatureHelp." "Handle notification window/progress" (setf (eglot--spinner server) (list id title done message))) +(cl-defmethod eglot-server-name ((server eglot-rls)) + "Return a friendly name describing the server." + (or (plist-get (eglot--server-info server) :name) + "rls")) + ;;; eclipse-jdt-specific ;;; @@ -2662,6 +2671,11 @@ If INTERACTIVE, prompt user for details." "Eclipse JDT breaks spec and replies with edits as arguments." (mapc #'eglot--apply-workspace-edit arguments)) +(cl-defmethod eglot-server-name ((server eglot-eclipse-jdt)) + "Return a friendly name describing the server." + (or (plist-get (eglot--server-info server) :name) + "eclipse-jdt")) + (provide 'eglot) ;;; eglot.el ends here