Skip to content

Commit fceda19

Browse files
authored
Fix project root discovery when project features aren't loaded. (#4463)
It's possible for the corresponding project package (i.e., projectile or project) to not be loaded yet but there to exist autoloads for the functions. In that situation, using `featurep` to check for the existence of the package will fail. Therefore, `fboundp` is used instead to check for the existence (possibly an autoload) of the needed functions.
1 parent 33c3afe commit fceda19

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lsp-mode.el

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3933,10 +3933,11 @@ If any filters, checks if it applies for PATH."
39333933
(defun lsp--suggest-project-root ()
39343934
"Get project root."
39353935
(or
3936-
(when (featurep 'projectile) (condition-case nil
3937-
(projectile-project-root)
3938-
(error nil)))
3939-
(when (featurep 'project)
3936+
(when (fboundp 'projectile-project-root)
3937+
(condition-case nil
3938+
(projectile-project-root)
3939+
(error nil)))
3940+
(when (fboundp 'project-current)
39403941
(when-let ((project (project-current)))
39413942
(if (fboundp 'project-root)
39423943
(project-root project)

0 commit comments

Comments
 (0)