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
(if workspaces
(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))
"C-mouse-1: Switch to another workspace folder
mouse-1: Describe current session
@ -1631,8 +1633,7 @@ mouse-3: Reconnect to server")
"LSP Disconnected
mouse-1: Reload to start server")
'mouse-face '(:box 0)
'local-map
(let ((map (make-sparse-keymap)))
'local-map (let ((map (make-sparse-keymap)))
(if workspaces
(progn
(define-key map [mode-line C-mouse-1]
@ -1649,10 +1650,11 @@ mouse-1: Reload to start server")
(interactive)
(ignore-errors (revert-buffer t t))))))
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-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-workspace-folders-changed-hook #'doom-modeline-update-lsp)
(defvar-local doom-modeline--eglot nil)
(defun doom-modeline-update-eglot ()