From 8dfc4b30330918d9f9b57b094d24a212235611a1 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 21 Oct 2019 18:29:11 -0400 Subject: [PATCH] tools/lsp: prompt for project if one can't be guessed #1928 And don't recognize $HOME as a valid project root. --- modules/tools/lsp/config.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/tools/lsp/config.el b/modules/tools/lsp/config.el index 8574b8499..89c3434e0 100644 --- a/modules/tools/lsp/config.el +++ b/modules/tools/lsp/config.el @@ -20,6 +20,15 @@ This can be a single company backend or a list thereof. It can be anything :definition 'lsp-find-definition :references 'lsp-find-references) + (defadvice! +lsp-prompt-if-no-project-a (root) + "Prompt for the project root only if no project was found. +Also refuses to recognize $HOME as a valid project root." + :filter-return #'lsp--calculate-root + (cond ((and root (not (file-equal-p root "~"))) + root) + (lsp-auto-guess-root + (lsp--find-root-interactively (lsp-session))))) + (defadvice! +lsp-init-a (&optional arg) "Enable `lsp-mode' in the current buffer.