tools/lsp: fix +lsp-prompt-if-no-project-a #1928

Don't prompt for blacklisted folders, and don't refuse to recognize
$HOME (let the user decide whether to blacklist it or not).
This commit is contained in:
Henrik Lissner 2019-11-08 00:02:50 -05:00
parent 3a74c81bf2
commit bf8ee34c19
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -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)