Skip to content

Commit

Permalink
Fix project root discovery when project features aren't loaded. (#4463)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
brownts committed May 27, 2024
1 parent 33c3afe commit fceda19
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lsp-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -3933,10 +3933,11 @@ If any filters, checks if it applies for PATH."
(defun lsp--suggest-project-root ()
"Get project root."
(or
(when (featurep 'projectile) (condition-case nil
(projectile-project-root)
(error nil)))
(when (featurep 'project)
(when (fboundp 'projectile-project-root)
(condition-case nil
(projectile-project-root)
(error nil)))
(when (fboundp 'project-current)
(when-let ((project (project-current)))
(if (fboundp 'project-root)
(project-root project)
Expand Down

0 comments on commit fceda19

Please sign in to comment.