Clojure-lsp: Use of deprecated method .getRootUri

Created on 27 Jun 2021  路  4Comments  路  Source: clojure-lsp/clojure-lsp

Hey there,

I was checking out the codebase and found out this is a deprecated method call:

https://github.com/clojure-lsp/clojure-lsp/blob/534831574ccaae0aafe60ed87c14a59ce85b2e52/src/clojure_lsp/main.clj#L298

It looks like this would be a fix:

       TextDocumentSyncOptions
+      WorkspaceFolder
       WorkspaceSymbolParams)
     (org.eclipse.lsp4j.launch LSPLauncher)
     (org.eclipse.lsp4j.services LanguageServer TextDocumentService WorkspaceService LanguageClient))
@@ -295,7 +296,10 @@
              (end
                (do
                  (log/info "Initializing...")
-                 (handlers/initialize (.getRootUri params)
+                 (handlers/initialize (-> params
+                                          .getWorkspaceFolders
+                                          ^WorkspaceFolder (first)
+                                          .getUri)

But I coudn't get it to pass GH actions (I'd get Timeout running integration tests! and no more info).

Perhaps you'd find this worth fixing?

bug enhancement

All 4 comments

Oh, I didn't know .getRootUri was deprecated, good to know I'l ltake a look!

Yeah, we heavily rely on this field, so integration tests would fail probably.

Thank you!

@vemv I noticed that the new field is not sent from emacs (lsp-mode) and maybe it's used for when the client support different workspaces, so I think we will have to keep using the .getRootUri until most clients use the new field.
Or at least fallback to the old one

Actually, it's supported in lsp-mode but they send as null, and according to the LSP spec, this means server should consider there is no workspace configured and discover the root itself, ATM we don't have that logic on the server so for now we should keep supporting the old .getRootUri I think

Kudos for giving this a shot!

Was this page helpful?
0 / 5 - 0 ratings