diff --git a/modules/tools/lsp/config.el b/modules/tools/lsp/config.el index c31591ff9..f4bdc3a79 100644 --- a/modules/tools/lsp/config.el +++ b/modules/tools/lsp/config.el @@ -53,12 +53,14 @@ auto-killed (which is usually an expensive process)." lsp--cur-workspace)))) (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." + "Prompt for the project root only if no project was found." :filter-return #'lsp--calculate-root - (cond ((and root (not (file-equal-p root "~"))) - root) - (lsp-auto-guess-root + (cond ((not lsp-auto-guess-root) nil) + ((null root) nil) + ((not (cl-find-if (lambda (dir) + (and (lsp--files-same-host dir root) + (file-in-directory-p dir root))) + (lsp-session-folders-blacklist (lsp-session)))) (lsp--find-root-interactively (lsp-session))))) (defadvice! +lsp-init-a (&optional arg)