Skip to content

Commit

Permalink
Per #354: make a public reader for project-nickname
Browse files Browse the repository at this point in the history
Close #399.

* eglot.el (eglot-lsp-server): Add a public reader for
project-nickname as eglot-project-nickname.
(eglot--connect, eglot--read-server, eglot--mode-line-format): Use
the public variant.
  • Loading branch information
nemethf committed Jan 13, 2020
1 parent 8d8c90d commit e53dd5c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions eglot.el
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,8 @@ treated as in `eglot-dbind'."
(defclass eglot-lsp-server (jsonrpc-process-connection)
((project-nickname
:documentation "Short nickname for the associated project."
:accessor eglot--project-nickname)
:accessor eglot--project-nickname
:reader eglot-project-nickname)
(major-mode
:documentation "Major mode symbol."
:accessor eglot--major-mode)
Expand Down Expand Up @@ -906,7 +907,7 @@ in project `%s'."
(or (plist-get serverInfo :name)
(jsonrpc-name server))
managed-major-mode
(eglot--project-nickname server))
(eglot-project-nickname server))
(when tag (throw tag t))))
:timeout eglot-connect-timeout
:error-fn (eglot--lambda ((ResponseError) code message)
Expand Down Expand Up @@ -1172,7 +1173,7 @@ and just return it. PROMPT shouldn't end with a question mark."
being hash-values of eglot--servers-by-project
append servers))
(name (lambda (srv)
(format "%s/%s" (eglot--project-nickname srv)
(format "%s/%s" (eglot-project-nickname srv)
(eglot--major-mode srv)))))
(cond ((null servers)
(eglot--error "No servers!"))
Expand Down Expand Up @@ -1388,7 +1389,7 @@ Uses THING, FACE, DEFS and PREPEND."
(defun eglot--mode-line-format ()
"Compose the EGLOT's mode-line."
(pcase-let* ((server (eglot-current-server))
(nick (and server (eglot--project-nickname server)))
(nick (and server (eglot-project-nickname server)))
(pending (and server (hash-table-count
(jsonrpc--request-continuations server))))
(`(,_id ,doing ,done-p ,_detail) (and server (eglot--spinner server)))
Expand Down

0 comments on commit e53dd5c

Please sign in to comment.