BetterThanTomorrow / calva

Clojure & ClojureScript Interactive Programming for VS Code
https://marketplace.visualstudio.com/items?itemName=betterthantomorrow.calva
Other
1.67k stars 217 forks source link

LSP on WSL not working after launching Getting Started REPL #1445

Open chadkennedyonline opened 2 years ago

chadkennedyonline commented 2 years ago

Steps to reproduce

1) VS Code running under Windows 10. 2) Follow instructions at https://calva.io/wsl/ 3) Run Calva: Fire up the "Getting Started" REPL.

Expected

"Initializing Clojure language features via clojure-lsp" spins for a limited time in the status bar.

Actual

"Initializing Clojure language features via clojure-lsp" spins forever in the status bar.

Additional Information:

In the Clojure Language Client window I see:

Dec 23, 2021 6:42:01 PM org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer fireError
SEVERE: An error occurred while processing an incoming message.
java.lang.NullPointerException
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:279)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
    at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.lang.Thread.run(Thread.java:829)
    at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:596)
    at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)

After turning on verbose logging, the beginning of the log in the Clojure Language Client window shows this:

[Trace - 7:19:46 PM] Sending request 'initialize - (0)'.
Params: {
    "processId": 1497,
    "clientInfo": {
        "name": "Visual Studio Code",
        "version": "1.63.2"
    },
    "locale": "en",
    "rootPath": null,
    "rootUri": null,
    "capabilities": {

Specifically, note that rootUri is null. This link may be demonstrating a similar issue from a different project: https://github.com/eclipse/xtext-core/issues/57

Trying using clojure-lsp.bat didn't help - same error.

Workaround

After running Calva: Fire up the "Getting Started" REPL, close the cljs files in vscode, then open the temp folder where they were located in vscode. Now run "Calva: Fire up the "Getting Started" REPL again, but tell it to use the existing temp folder.

Credits

Thanks to @bringe, @PEZ, and especially to @ericdallo for helping me to work through the issue. Eric was super-helpful!

chadkennedyonline commented 2 years ago

I've also seen this on a straight Windows installation, using scoop Clojure. No WSL involved.

denizoz commented 1 year ago

IF the issue is with starting up nREPL, I loaded a previous version of the extension and it worked for me I have WSL2 setup , java installed, VSCODE on windows 11 with remote WSL extension running.

bpringe commented 1 year ago

@denizoz There was a related change in 2.0.330. Can you tell us if the problem persists for you in this version?

Can you also test this, @chadkennedyonline?

I don't know if that would fix the issue, but it's worth checking it out.