Skip to content

Commit c72054a

Browse files
authored
lsp-workspace-root: to return best match instead of first (#2619)
* lsp-workspace-root: to return best match instead of first * Update lsp-mode.el
1 parent 48f1d0f commit c72054a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lsp-mode.el

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4414,9 +4414,10 @@ one of the LANGUAGES."
44144414
(file-name (lsp-f-canonical file-name)))
44154415
(->> (lsp-session)
44164416
(lsp-session-folders)
4417-
(--first (and (lsp--files-same-host it file-name)
4417+
(--filter (and (lsp--files-same-host it file-name)
44184418
(or (lsp-f-ancestor-of? it file-name)
4419-
(equal it file-name)))))))
4419+
(equal it file-name))))
4420+
(--max-by (> (length it) (length other))))))
44204421

44214422
(defun lsp-on-revert ()
44224423
"Executed when a file is reverted.

0 commit comments

Comments
 (0)