mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-23 19:19:50 +00:00
Improve LSP segment.
This commit is contained in:
parent
6f54eb240e
commit
4a694ece9b
1 changed files with 71 additions and 73 deletions
|
@ -1588,8 +1588,6 @@ mouse-3: Describe current input method")
|
|||
(defun doom-modeline-update-lsp (&rest _)
|
||||
"Update `lsp-mode' status."
|
||||
(setq doom-modeline--lsp
|
||||
(concat
|
||||
" "
|
||||
(let* ((workspaces (lsp-workspaces))
|
||||
(face (if workspaces 'success 'warning))
|
||||
(icon (doom-modeline-lsp-icon "LSP" face)))
|
||||
|
@ -1622,8 +1620,7 @@ mouse-1: Reload to start server")
|
|||
(lambda ()
|
||||
(interactive)
|
||||
(revert-buffer t t)))))
|
||||
map)))
|
||||
" ")))
|
||||
map)))))
|
||||
(add-hook 'lsp-mode-hook #'doom-modeline-update-lsp)
|
||||
(add-hook 'lsp-after-uninitialized-hook #'doom-modeline-update-lsp)
|
||||
|
||||
|
@ -1644,8 +1641,6 @@ mouse-1: Reload to start server")
|
|||
(nick 'success)
|
||||
(t 'mode-line)))
|
||||
(icon (doom-modeline-lsp-icon "EGLOT" face)))
|
||||
(concat
|
||||
" "
|
||||
(propertize icon
|
||||
'face `(:inherit ,(get-text-property 0 'face icon))
|
||||
'help-echo (cond
|
||||
|
@ -1681,23 +1676,26 @@ mouse-3: Reconnect to server" nick (eglot--major-mode server)))
|
|||
#'eglot-shutdown)
|
||||
(define-key map [mode-line mouse-3]
|
||||
#'eglot-reconnect)))
|
||||
map))
|
||||
" "))))
|
||||
map)))))
|
||||
(add-hook 'eglot--managed-mode-hook #'doom-modeline-update-eglot)
|
||||
|
||||
(doom-modeline-def-segment lsp
|
||||
"The LSP server state."
|
||||
(when doom-modeline-lsp
|
||||
(when-let ((icon (cond ((bound-and-true-p lsp-mode)
|
||||
(when-let ((active (doom-modeline--active))
|
||||
(icon (cond ((bound-and-true-p lsp-mode)
|
||||
doom-modeline--lsp)
|
||||
((bound-and-true-p eglot--managed-mode)
|
||||
doom-modeline--eglot))))
|
||||
(concat
|
||||
(propertize " " 'face (if active 'mode-line 'mode-line-inactive))
|
||||
(propertize icon 'face `(:inherit
|
||||
,(get-text-property 1 'face icon)
|
||||
,(get-text-property 0 'face icon)
|
||||
:inherit
|
||||
,(if (doom-modeline--active)
|
||||
'mode-line
|
||||
'mode-line-inactive))))))
|
||||
'mode-line-inactive)))
|
||||
(propertize " " 'face (if active 'mode-line 'mode-line-inactive))))))
|
||||
|
||||
(defun doom-modeline-override-eglot-modeline ()
|
||||
"Override `eglot' mode-line."
|
||||
|
|
Loading…
Reference in a new issue