Optimize lsp segment.

This commit is contained in:
Vincent Zhang 2019-06-29 01:21:32 +08:00
parent 24d30ccc1e
commit ee4619d367

View file

@ -1622,7 +1622,9 @@ mouse-3: Describe current input method")
'help-echo 'help-echo
(if workspaces (if workspaces
(concat "LSP Connected " (concat "LSP Connected "
(string-join (--map (format "[%s]\n" (lsp--workspace-print it)) (string-join
(mapcar (lambda (w)
(format "[%s]\n" (lsp--workspace-print w)))
workspaces)) workspaces))
"C-mouse-1: Switch to another workspace folder "C-mouse-1: Switch to another workspace folder
mouse-1: Describe current session mouse-1: Describe current session
@ -1631,8 +1633,7 @@ mouse-3: Reconnect to server")
"LSP Disconnected "LSP Disconnected
mouse-1: Reload to start server") mouse-1: Reload to start server")
'mouse-face '(:box 0) 'mouse-face '(:box 0)
'local-map 'local-map (let ((map (make-sparse-keymap)))
(let ((map (make-sparse-keymap)))
(if workspaces (if workspaces
(progn (progn
(define-key map [mode-line C-mouse-1] (define-key map [mode-line C-mouse-1]
@ -1649,10 +1650,11 @@ mouse-1: Reload to start server")
(interactive) (interactive)
(ignore-errors (revert-buffer t t)))))) (ignore-errors (revert-buffer t t))))))
map))))) map)))))
(add-hook 'lsp-before-initialize-hook #'doom-modeline-update-lsp)
(add-hook 'lsp-after-initialize-hook #'doom-modeline-update-lsp) (add-hook 'lsp-after-initialize-hook #'doom-modeline-update-lsp)
(add-hook 'lsp-after-uninitialized-hook #'doom-modeline-update-lsp) (add-hook 'lsp-after-uninitialized-hook #'doom-modeline-update-lsp)
(add-hook 'lsp-before-open-hook #'doom-modeline-update-lsp)
(add-hook 'lsp-after-open-hook #'doom-modeline-update-lsp) (add-hook 'lsp-after-open-hook #'doom-modeline-update-lsp)
(add-hook 'lsp-workspace-folders-changed-hook #'doom-modeline-update-lsp)
(defvar-local doom-modeline--eglot nil) (defvar-local doom-modeline--eglot nil)
(defun doom-modeline-update-eglot () (defun doom-modeline-update-eglot ()