Skip to content

Commit

Permalink
Add eglot-server-name
Browse files Browse the repository at this point in the history
Fix #354

* eglot.el (eglot-server-name): New cl-defmethod for the base
class, eglot-rls, and eglot-eclipse-jdt.
(eglot--connect): Use it.
  • Loading branch information
nemethf committed Nov 22, 2019
1 parent 86310c0 commit ea5c8f3
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions eglot.el
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down Expand Up @@ -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))))
Expand Down Expand Up @@ -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
;;;
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit ea5c8f3

Please sign in to comment.