mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-23 19:19:50 +00:00
[Enhancement] Improve lsp indicator.
This commit is contained in:
parent
aebaa760c6
commit
5774186d18
1 changed files with 22 additions and 13 deletions
|
@ -138,6 +138,7 @@
|
|||
(declare-function image-get-display-property 'image-mode)
|
||||
(declare-function jsonrpc--request-continuations 'jsonrpc)
|
||||
(declare-function jsonrpc-last-error 'jsonrpc)
|
||||
(declare-function lsp--cleanup-hanging-watches 'lsp-mode)
|
||||
(declare-function lsp--workspace-print 'lsp-mode)
|
||||
(declare-function lsp-describe-session 'lsp-mode)
|
||||
(declare-function lsp-restart-workspace 'lsp-mode)
|
||||
|
@ -1536,7 +1537,7 @@ mouse-3: Describe current input method")
|
|||
;;
|
||||
|
||||
(defvar doom-modeline--lsp nil)
|
||||
(defun doom-modeline-update-lsp ()
|
||||
(defun doom-modeline-update-lsp (&rest _)
|
||||
"Update `lsp-mode' status."
|
||||
(setq doom-modeline--lsp
|
||||
(concat
|
||||
|
@ -1558,10 +1559,12 @@ mouse-3: Describe current input method")
|
|||
mouse-1: Describe current session
|
||||
mouse-2: Quit server
|
||||
mouse-3: Reconnect to server")
|
||||
"LSP Disconnected")
|
||||
'mouse-face (if workspaces '(:box 0))
|
||||
"LSP Disconnected
|
||||
mouse-1: Reload to start server")
|
||||
'mouse-face '(:box 0)
|
||||
'local-map (let ((map (make-sparse-keymap)))
|
||||
(when workspaces
|
||||
(if workspaces
|
||||
(progn
|
||||
(define-key map [mode-line C-mouse-1]
|
||||
#'lsp-workspace-folders-switch)
|
||||
(define-key map [mode-line mouse-1]
|
||||
|
@ -1570,9 +1573,15 @@ mouse-3: Reconnect to server")
|
|||
#'lsp-shutdown-workspace)
|
||||
(define-key map [mode-line mouse-3]
|
||||
#'lsp-restart-workspace))
|
||||
(progn
|
||||
(define-key map [mode-line mouse-1]
|
||||
(lambda ()
|
||||
(interactive)
|
||||
(revert-buffer t t)))))
|
||||
map)))
|
||||
" ")))
|
||||
(add-hook 'lsp-mode-hook #'doom-modeline-update-lsp)
|
||||
(advice-add #'lsp--cleanup-hanging-watches :after #'doom-modeline-update-lsp)
|
||||
|
||||
(defvar doom-modeline--eglot nil)
|
||||
(defun doom-modeline-update-eglot ()
|
||||
|
@ -1647,7 +1656,7 @@ mouse-3: Reconnect to server" nick (eglot--major-mode server)))
|
|||
((bound-and-true-p lsp-mode)
|
||||
doom-modeline--lsp)
|
||||
((bound-and-true-p eglot--managed-mode)
|
||||
doom-modeline--eglot))))
|
||||
(doom-modeline-update-eglot)))))
|
||||
|
||||
(defun doom-modeline-override-eglot-modeline ()
|
||||
"Override `eglot' mode-line."
|
||||
|
|
Loading…
Reference in a new issue