From 59a5d1e8d27dbf59e7a574c2cb3f3238dddefc4d Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Fri, 2 Aug 2019 00:44:43 +0800 Subject: [PATCH] Fix #203: Add custom faces for the LSP icon. --- doom-modeline-core.el | 15 +++++++++++++++ doom-modeline-segments.el | 8 ++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/doom-modeline-core.el b/doom-modeline-core.el index 2e3e91a..2bada42 100644 --- a/doom-modeline-core.el +++ b/doom-modeline-core.el @@ -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 diff --git a/doom-modeline-segments.el b/doom-modeline-segments.el index f434fba..6d2ea95 100644 --- a/doom-modeline-segments.el +++ b/doom-modeline-segments.el @@ -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