From 84ff61a66039efd02ce103d0fa9578a07dcb1457 Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Tue, 26 Feb 2019 15:20:39 +0700 Subject: [PATCH] [Feature] New lsp indicator with an icon. --- doom-modeline-segments.el | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/doom-modeline-segments.el b/doom-modeline-segments.el index 70ea539..c979b95 100644 --- a/doom-modeline-segments.el +++ b/doom-modeline-segments.el @@ -109,7 +109,8 @@ (declare-function iedit-find-current-occurrence-overlay 'iedit-lib) (declare-function iedit-prev-occurrence 'iedit-lib) (declare-function image-get-display-property 'image-mode) -(declare-function lsp-mode-line 'lsp-mode) +(declare-function lsp-workspaces 'lsp-mode) +(declare-function lsp--workspace-print 'lsp-mode) (declare-function magit-toplevel 'magit-git) (declare-function minions-minor-modes-menu 'minions) (declare-function nyan-create 'nyan-mode) @@ -1408,7 +1409,23 @@ mouse-3: Describe current input method") (if (and doom-modeline-lsp (doom-modeline--active) (bound-and-true-p lsp-mode)) - (concat (lsp-mode-line) " "))) + (concat + " " + (let ((icon (if doom-modeline-icon + (doom-modeline-icon-faicon "rocket" :v-adjust -0.0575) + "LSP")) + (workspaces (lsp-workspaces))) + (propertize icon + 'face (let ((face (if workspaces 'success 'warning))) + (if doom-modeline-icon + `(:height 1.1 :family ,(all-the-icons-icon-family icon) :inherit ,face) + face)) + 'help-echo (if workspaces + (concat "LSP Connected " + (string-join (--map (format "[%s]" (lsp--workspace-print it)) + workspaces))) + "LSP Disconnected"))) + " "))) ;;