Skip to content

Commit 4c87e81

Browse files
aureumleonisyyoncho
authored andcommitted
Fix symlink handling in project root recognition (#783)
* Fix symlink handling in project root recognition * Updated lsp-workspace-root to use f-canonical for nil case
1 parent f61250e commit 4c87e81

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lsp-mode.el

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2884,7 +2884,7 @@ Applies on type formatting."
28842884
(when-let (file-name (or path (buffer-file-name)))
28852885
(->> (lsp-session)
28862886
(lsp-session-folders)
2887-
(--first (f-ancestor-of? it file-name)))))
2887+
(--first (f-ancestor-of? it (f-canonical file-name))))))
28882888

28892889
(defun lsp-on-revert ()
28902890
"Executed when a file is reverted.
@@ -4878,12 +4878,13 @@ Returns nil if the project should not be added to the current SESSION."
48784878

48794879
(defun lsp-find-session-folder (session file-name)
48804880
"Look in the current SESSION for folder containing FILE-NAME."
4881-
(->> session
4882-
(lsp-session-folders)
4883-
(--filter (or (f-same? it file-name)
4884-
(f-ancestor-of? it file-name)))
4885-
(--max-by (> (length it)
4886-
(length other)))))
4881+
(let ((file-name-canonical (f-canonical file-name)))
4882+
(->> session
4883+
(lsp-session-folders)
4884+
(--filter (or (f-same? it file-name-canonical)
4885+
(f-ancestor-of? it file-name-canonical)))
4886+
(--max-by (> (length it)
4887+
(length other))))))
48874888

48884889
(defun lsp-find-workspace (server-id file-name)
48894890
"Find workspace for SERVER-ID for FILE-NAME."

0 commit comments

Comments
 (0)