tools/lsp: fix LSP prompting for project too often

This commit is contained in:
Henrik Lissner 2019-11-10 05:05:42 -05:00
parent 829e1762b1
commit 58e674d8fb
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -52,16 +52,17 @@ auto-killed (which is usually an expensive process)."
(funcall orig-fn)))) (funcall orig-fn))))
lsp--cur-workspace)))) lsp--cur-workspace))))
(defadvice! +lsp-prompt-if-no-project-a (root) (defadvice! +lsp-prompt-if-no-project-a (session file-name)
"Prompt for the project root only if no project was found." "Prompt for the project root only if no project was found."
:filter-return #'lsp--calculate-root :after-until #'lsp--calculate-root
(cond ((not lsp-auto-guess-root) nil) (cond ((not lsp-auto-guess-root)
((null root) nil) nil)
((not (cl-find-if (lambda (dir) ((cl-find-if (lambda (dir)
(and (lsp--files-same-host dir root) (and (lsp--files-same-host dir file-name)
(file-in-directory-p dir root))) (file-in-directory-p file-name dir)))
(lsp-session-folders-blacklist (lsp-session)))) (lsp-session-folders-blacklist session))
(lsp--find-root-interactively (lsp-session))))) nil)
((lsp--find-root-interactively 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.