Skip to content

Commit 83c64a4

Browse files
committed
Fix lsp.el/lsp-mode.el handling in lsp-java--find-project-uri
1 parent 11e284d commit 83c64a4

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

lsp-java.el

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -782,13 +782,24 @@ server."
782782

783783
(defun lsp-java--find-project-uri (file-uri)
784784
"Return the java project corresponding FILE-URI."
785-
(->> (lsp--uri-to-path file-uri)
786-
(lsp-find-workspace 'jdtls)
787-
lsp-java--get-project-uris
788-
(--filter (s-starts-with? (lsp--uri-to-path it) (lsp--uri-to-path file-uri)))
789-
(-max-by (lambda (project-a project-b)
790-
(> (length project-a)
791-
(length project-b))))))
785+
(if (functionp 'lsp-find-workspace)
786+
(->> (lsp--uri-to-path file-uri)
787+
(lsp-find-workspace 'jdtls)
788+
lsp-java--get-project-uris
789+
(--filter (s-starts-with? (lsp--uri-to-path it) (lsp--uri-to-path file-uri)))
790+
(-max-by (lambda (project-a project-b)
791+
(> (length project-a)
792+
(length project-b)))))
793+
(->> lsp--workspaces
794+
ht-values
795+
-uniq
796+
(-map 'lsp-java--get-project-uris)
797+
-flatten
798+
(--filter (s-starts-with? (lsp--uri-to-path it)
799+
(lsp--uri-to-path file-uri)))
800+
(-max-by (lambda (project-a project-b)
801+
(> (length project-a)
802+
(length project-b)))))))
792803

793804
(defun lsp-java--before-start (&rest _args)
794805
"Initialize lsp java variables."

0 commit comments

Comments
 (0)