From 16a17ad9707886f2b5e1d5b4f4ee953cc2d9be22 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 2 Nov 2019 15:50:26 -0400 Subject: [PATCH] tools/lsp: start lsp server unconditionally Part 2 of f6d3ee588, in order for server restarting to work, since shutting down the server doesn't turn off lsp-mode. --- modules/tools/lsp/config.el | 41 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/modules/tools/lsp/config.el b/modules/tools/lsp/config.el index 4349943c8..e37dcf8dd 100644 --- a/modules/tools/lsp/config.el +++ b/modules/tools/lsp/config.el @@ -74,27 +74,26 @@ been moved out to their respective modules, or these hooks: Also logs the resolved project root, if found." :override #'lsp (interactive "P") - (if (bound-and-true-p lsp-mode) t - (require 'lsp-mode) - (when lsp-auto-configure - (require 'lsp-clients)) - (and (buffer-file-name) - (setq-local - lsp--buffer-workspaces - (or (lsp--try-open-in-library-workspace) - (lsp--try-project-root-workspaces - (equal arg '(4)) - (and arg (not (equal arg 1)))))) - (prog1 (lsp-mode 1) - ;; Announce what project root we're using, for diagnostic purposes - (if-let (root (lsp--calculate-root (lsp-session) (buffer-file-name))) - (lsp--info "Guessed project root is %s" (abbreviate-file-name root)) - (lsp--info "Could not guess project root.")) - (lsp--info "Connected to %s." - (apply #'concat - (mapcar - (lambda (it) (format "[%s]" (lsp--workspace-print it))) - lsp--buffer-workspaces))))))) + (require 'lsp-mode) + (when lsp-auto-configure + (require 'lsp-clients)) + (and (buffer-file-name) + (setq-local + lsp--buffer-workspaces + (or (lsp--try-open-in-library-workspace) + (lsp--try-project-root-workspaces + (equal arg '(4)) + (and arg (not (equal arg 1)))))) + (prog1 (lsp-mode 1) + ;; Announce what project root we're using, for diagnostic purposes + (if-let (root (lsp--calculate-root (lsp-session) (buffer-file-name))) + (lsp--info "Guessed project root is %s" (abbreviate-file-name root)) + (lsp--info "Could not guess project root.")) + (lsp--info "Connected to %s." + (apply #'concat + (mapcar + (lambda (it) (format "[%s]" (lsp--workspace-print it))) + lsp--buffer-workspaces)))))) ;; Don't prompt to restart LSP servers while quitting Emacs (add-hook! 'kill-emacs-hook (setq lsp-restart 'ignore)))