Show lsp indicator in both active and inactive windows.

This commit is contained in:
Vincent Zhang 2019-05-06 22:55:49 +08:00
parent 6d80564d4a
commit 2bbfcbe685
2 changed files with 15 additions and 11 deletions

View file

@ -1524,7 +1524,7 @@ mouse-3: Describe current input method")
(defun doom-modeline-lsp-icon (text face) (defun doom-modeline-lsp-icon (text face)
"Display LSP icon (or TEXT in terminal) with FACE." "Display LSP icon (or TEXT in terminal) with FACE."
(if doom-modeline-icon (if doom-modeline-icon
(doom-modeline-icon-faicon "rocket" :face face :v-adjust -0.0575) (doom-modeline-icon-faicon "rocket" :height 1.0 :face face :v-adjust -0.0575)
(propertize text 'face face))) (propertize text 'face face)))
(defvar doom-modeline--lsp nil) (defvar doom-modeline--lsp nil)
@ -1630,13 +1630,17 @@ mouse-3: Reconnect to server" nick (eglot--major-mode server)))
(doom-modeline-def-segment lsp (doom-modeline-def-segment lsp
"The LSP server state." "The LSP server state."
(if (and doom-modeline-lsp (when doom-modeline-lsp
(doom-modeline--active)) (when-let ((icon (cond ((bound-and-true-p lsp-mode)
(cond doom-modeline--lsp)
((bound-and-true-p lsp-mode) ((bound-and-true-p eglot--managed-mode)
doom-modeline--lsp) doom-modeline--eglot))))
((bound-and-true-p eglot--managed-mode) (propertize icon 'face `(:inherit
doom-modeline--eglot)))) ,(get-text-property 1 'face icon)
:inherit
,(if (doom-modeline--active)
'mode-line
'mode-line-inactive))))))
(defun doom-modeline-override-eglot-modeline () (defun doom-modeline-override-eglot-modeline ()
"Override `eglot' mode-line." "Override `eglot' mode-line."

View file

@ -84,7 +84,7 @@
(doom-modeline-def-modeline 'main (doom-modeline-def-modeline 'main
'(bar workspace-name window-number modals matches buffer-info remote-host buffer-position parrot selection-info) '(bar workspace-name window-number modals matches buffer-info remote-host buffer-position parrot selection-info)
'(objed-state misc-info persp-name lsp irc mu4e github debug fancy-battery minor-modes input-method buffer-encoding major-mode process vcs checker)) '(objed-state misc-info persp-name fancy-battery irc mu4e github debug lsp minor-modes input-method buffer-encoding major-mode process vcs checker))
(doom-modeline-def-modeline 'minimal (doom-modeline-def-modeline 'minimal
'(bar matches " " buffer-info) '(bar matches " " buffer-info)
@ -92,11 +92,11 @@
(doom-modeline-def-modeline 'special (doom-modeline-def-modeline 'special
'(bar window-number modals matches buffer-info-simple buffer-position parrot selection-info) '(bar window-number modals matches buffer-info-simple buffer-position parrot selection-info)
'(objed-state misc-info lsp irc-buffers debug fancy-battery minor-modes input-method buffer-encoding major-mode process checker)) '(objed-state misc-info fancy-battery irc-buffers debug lsp minor-modes input-method buffer-encoding major-mode process checker))
(doom-modeline-def-modeline 'project (doom-modeline-def-modeline 'project
'(bar window-number " " buffer-default-directory) '(bar window-number " " buffer-default-directory)
'(misc-info mu4e github debug fancy-battery " " major-mode process)) '(misc-info fancy-battery mu4e github debug " " major-mode process))
(doom-modeline-def-modeline 'media (doom-modeline-def-modeline 'media
'(bar window-number buffer-size buffer-info) '(bar window-number buffer-size buffer-info)