Fork me on GitHub
#calva
<
2023-04-20
>
Mario Trost08:04:53

Somehow I have lost these commands in Clojure(Script) files:

Mario Trost08:04:30

Just checked in a JS file, they still work there. But everything relating to code navigation is gone in clj/cljs files after I restarted my computer and probably got some VS Code upgrades.

Mario Trost08:04:48

aaaaaand it's back

pez08:04:57

Wow. That was weird.

Mario Trost08:04:23

Running Calva Clojure LSP: Restart the Language Server for a third time worked, didn't the first two times. So all good now, thanks for reading 😄

Mario Trost08:04:02

Computers, complicated stuff

pez08:04:57

clojure-lsp sometimes fails to start for me too when starting VS Code from fresh. It usually complains wildly, though.

Mario Trost08:04:31

I must have overlooked it. That's the output window of the failing Clojure Language Client:

[Trace - 08:50:43] Sending request 'initialize - (0)'.
[Error - 08:50:43] Connection to server got closed. Server will not be restarted.
[Error - 08:50:43] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 08:50:43] Clojure Language Client client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 

Carsten Behring14:04:00

When editing a deps.edn file in Calva, I get on "every change" an error popup :

[Error - 2:01:32 PM] Request textDocument/documentSymbol failed.
  Message: Internal error
  Code: -32603 
[object Object]
It does not happen on clj files. Any idea how to fix it ?

Carsten Behring14:04:40

It comes frm a "Clojure Language Client" its seem, is this LSP ?

Carsten Behring14:04:53

I am in a "remote development" setup, so connected to a Docker container in a remote machine. Are there any known isue with this for teh Clojure LSP . I think I don't have it running

Carsten Behring14:04:39

I was able to get a stack trcae :

2023-04-20T14:40:05.971Z  INFO [clojure-lsp.dep-graph:269] - :maintain-dep-graph 0ms
2023-04-20T14:40:05.972Z  INFO [clojure-lsp.handlers:179] - :did-open 73ms
2023-04-20T14:40:05.972Z  WARN [clojure-lsp.server:401] - {:settings {}}
2023-04-20T14:40:05.972Z  INFO [clojure-lsp.server:164] - :refreshing-test-tree 0ms
2023-04-20T14:40:05.973Z  INFO [clojure-lsp.handlers:274] - :document-symbol 0ms
2023-04-20T14:40:05.998Z  INFO [clojure-lsp.server:102] - :publish-diagnostics 0ms
2023-04-20T14:40:06.017Z  INFO [clojure-lsp.db:65] - [DB] Reading transit analysis cache from /home/vscode/.cache/clojure-lsp/db.transit.json db took 225ms
2023-04-20T14:40:06.025Z  INFO [clojure-lsp.feature.java-interop:271] - [Java] JDK source already present on global LSP cache dir.
2023-04-20T14:40:06.013Z  ERROR [clojure-lsp.server:55] - Error receiving message: Internal error (-32603)
{:id 4, :method "textDocument/documentSymbol"}
com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine  PosixPlatformThreads.java:  203
            com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine       PlatformThreads.java:  775
                            java.util.concurrent.ForkJoinWorkerThread.run  ForkJoinWorkerThread.java:  183
                              java.util.concurrent.ForkJoinPool.runWorker          ForkJoinPool.java: 1594
                                   java.util.concurrent.ForkJoinPool.scan          ForkJoinPool.java: 1656
                 java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec          ForkJoinPool.java: 1020
                                 java.util.concurrent.ForkJoinTask.doExec          ForkJoinTask.java:  290
                  java.util.concurrent.CompletableFuture$AsyncSupply.exec     CompletableFuture.java: 1692
                   java.util.concurrent.CompletableFuture$AsyncSupply.run     CompletableFuture.java: 1700
                                                promesa.util.Supplier/get                  util.cljc:   34
                                            promesa.exec/wrap-bindings/fn                  exec.cljc:  163
                                                 clojure-lsp.server/fn/fn                 server.clj:  339
                                     clojure-lsp.handlers/document-symbol               handlers.clj:  278
                     clojure-lsp.feature.document-symbol/document-symbols        document_symbol.clj:   90
                    clojure-lsp.feature.document-symbol/edn->element-tree        document_symbol.clj:   65
                                                      clojure.core/reduce                   core.clj: 6886
                                              clojure.core.protocols/fn/G              protocols.clj:   13
                                                clojure.core.protocols/fn              protocols.clj:   75
                                       clojure.core.protocols/iter-reduce              protocols.clj:   49
                 clojure-lsp.feature.document-symbol/edn->element-tree/fn        document_symbol.clj:   80
                    clojure-lsp.feature.document-symbol/edn->element-tree        document_symbol.clj:   65
                                                      clojure.core/reduce                   core.clj: 6886
                                              clojure.core.protocols/fn/G              protocols.clj:   13
                                                clojure.core.protocols/fn              protocols.clj:   75
                                       clojure.core.protocols/iter-reduce              protocols.clj:   49
                 clojure-lsp.feature.document-symbol/edn->element-tree/fn        document_symbol.clj:   80
                    clojure-lsp.feature.document-symbol/edn->element-tree        document_symbol.clj:   65
                                                      clojure.core/reduce                   core.clj: 6886
                                              clojure.core.protocols/fn/G              protocols.clj:   13
                                                clojure.core.protocols/fn              protocols.clj:   75
                                       clojure.core.protocols/iter-reduce              protocols.clj:   49
                 clojure-lsp.feature.document-symbol/edn->element-tree/fn        document_symbol.clj:   80
                    clojure-lsp.feature.document-symbol/edn->element-tree        document_symbol.clj:   65
                                                      clojure.core/reduce                   core.clj: 6886
                                              clojure.core.protocols/fn/G              protocols.clj:   13
                                                clojure.core.protocols/fn              protocols.clj:   75
                                       clojure.core.protocols/iter-reduce              protocols.clj:   49
                 clojure-lsp.feature.document-symbol/edn->element-tree/fn        document_symbol.clj:   68
             clojure-lsp.feature.document-symbol/element->document-symbol        document_symbol.clj:   43
                        clojure-lsp.feature.document-symbol/element->name        document_symbol.clj:   38
                                                        clojure.core/name                   core.clj: 1610
java.lang.NullPointerException: 

2023-04-20T14:40:06.296Z  INFO [clojure-lsp.dep-graph:269] - :maintain-dep-graph 212ms
2023-04-20T14:40:06.304Z  INFO [clojure-lsp.feature.java-interop:312] - [Java] JDK source analysis cache loaded successfully.

pez14:04:57

I think some deps.edn support was added to latest clojure-lsp. @UKFSJSM38 might know how we should deal with this?

seancorfield14:04:32

I've been running into this too when I've been working with a remote session, and I end up having to restart LSP or reload the window. (After switching back to a local repl session)

bringe15:04:09

It’s this issue ^

bringe15:04:04

You can switch to the previous clojure-lsp release for now by setting calva.clojureLspVersion to "2023.02.27-13.12.12" , and you won’t see that error any more. Just remember to reset that setting once the problem is fixed in clojure-lsp.

seancorfield15:04:16

Interesting... Yeah, I was editing a Calva REPL snippets config.edn file and got this error: and it's fully of maps inside vectors... I wonder why it seemed to go away on a reload when editing a deps.edn file? Unless I switched to a different deps.edn file and just didn't associate the file change with the error going away? (probably!)

ericdallo16:04:19

I think internal errors from feature X in clojure-lsp should not show popups to user, it's a feature that shows only when user opens the tree window

seancorfield16:04:11

"tree window"?

seancorfield16:04:11

Ah, OK. When you said "window" I was like "How do I open this new window?" 🙂

🙂 2
bringe18:04:05

> I think internal errors from feature X in clojure-lsp should not show popups to user, it’s a feature that shows only when user opens the tree window I think this is being done by the vscode lsp client lib. We can probably override that.

👍 2
ericdallo19:04:10

thanks! BTW made a commit in clojure-lsp fixing the symbol issue in the tree which should fix most cases, available at nightly in a few mins

metal 2
bringe15:04:04

You can switch to the previous clojure-lsp release for now by setting calva.clojureLspVersion to "2023.02.27-13.12.12" , and you won’t see that error any more. Just remember to reset that setting once the problem is fixed in clojure-lsp.

Ben Lieberman22:04:58

I'm getting repeated popups with this message

[Error - 4:10:17 PM] Request textDocument/documentSymbol failed.
  Message: Internal error
  Code: -32603 
[object Object]
[Error - 4:11:19 PM] Request textDocument/documentSymbol failed.
  Message: Internal error
  Code: -32603 
[object Object]
[Error - 4:11:20 PM] Request textDocument/documentSymbol failed.
  Message: Internal error
  Code: -32603 
[object Object]
[Error - 4:11:22 PM] Request textDocument/documentSymbol failed.
  Message: Internal error
  Code: -32603 
[object Object]
when editing a shadow-cljs.edn file.

Ben Lieberman22:04:07

I see this might be related to above issue

bringe23:04:41

I think we can override the lsp client lib Calva uses to not show popups for error messages. In this case I don’t think they effect the Calva experience, and even when they do, popups are a poor choice for communication, I think... These are related to a new clojure-lsp feature.

skylize13:04:45

I agree that popups are not exactly ideal here. But I would hate to instead have errors just getting swallowed indiscriminately, without a conscious per-error decision by the Calva Team. In lieu of a better suggestion, I can at least think of a minor tweak that would improve the experience significantly: Simply attach a "Clojure LSP" label to these LSP errors. This would make the error feel a lot less cryptic and give some sense of scope, instead of spamming a message that has no more meaning to the average user than just "something is broken."

bringe14:04:01

Well in this case there isn’t even anything broken with Calva (IIUC) - the errors are related to a new lsp feature that doesn’t involve Calva (at this point, at least). Tagging them as coming from clojure-lsp doesn’t make them any less spammy and annoying. I think I’d rather that if something were broken, in the process of debugging we have the user check the server<->client logs instead.

bringe14:04:04

@U90R0EPHA If you don’t mind, comment further on the related GH issue, so we can have the discussion isolated there, and so we don’t spam @U03QBKTVA0N’s thread 😃

2
skylize14:04:41

What GH issue?