tools/lsp: prompt for project if one can't be guessed #1928

And don't recognize $HOME as a valid project root.
This commit is contained in:
Henrik Lissner 2019-10-21 18:29:11 -04:00
parent 0cca037448
commit 8dfc4b3033
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -20,6 +20,15 @@ This can be a single company backend or a list thereof. It can be anything
:definition 'lsp-find-definition :definition 'lsp-find-definition
:references 'lsp-find-references) :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) (defadvice! +lsp-init-a (&optional arg)
"Enable `lsp-mode' in the current buffer. "Enable `lsp-mode' in the current buffer.