Fix #203: Add custom faces for the LSP icon.

This commit is contained in:
Vincent Zhang 2019-08-02 00:44:43 +08:00
parent 6ecda37e45
commit 59a5d1e8d2
2 changed files with 19 additions and 4 deletions

View file

@ -422,6 +422,21 @@ If the actual char height is larger, it respects the actual char height."
"Face for the replace state tag in evil state indicator."
:group 'doom-modeline-faces)
(defface doom-modeline-lsp-success
'((t (:inherit success)))
"Face for success state in LSP."
:group 'doom-modeline-faces)
(defface doom-modeline-lsp-warning
'((t (:inherit warning)))
"Face for warning state in LSP."
:group 'doom-modeline-faces)
(defface doom-modeline-lsp-error
'((t (:inherit error)))
"Face for error state in LSP."
:group 'doom-modeline-faces)
;;
;; Externals

View file

@ -1613,7 +1613,7 @@ mouse-3: Describe current input method")
"Update `lsp-mode' status."
(setq doom-modeline--lsp
(let* ((workspaces (lsp-workspaces))
(face (if workspaces 'success 'warning))
(face (if workspaces 'doom-modeline-lsp-success 'error))
(icon (doom-modeline-lsp-icon "LSP" face)))
(propertize icon
'help-echo
@ -1664,10 +1664,10 @@ mouse-1: Reload to start server")
(`(,_id ,doing ,done-p ,detail) (and server (eglot--spinner server)))
(last-error (and server (jsonrpc-last-error server)))
(face (cond
(last-error 'error)
(last-error 'doom-modeline-lsp-error)
((and doing (not done-p)) 'compilation-mode-line-run)
((and pending (cl-plusp pending)) 'warning)
(nick 'success)
((and pending (cl-plusp pending)) 'doom-modeline-lsp-warning)
(nick 'doom-modeline-lsp-success)
(t 'mode-line)))
(icon (doom-modeline-lsp-icon "EGLOT" face)))
(propertize icon