Fork me on GitHub
#calva
<
2024-01-02
>
otwieracz09:01:13

Hello. Any ideas why Calva with Error Lens seems to display out-of-date error messages?

pez09:01:16

It’s probably to do with how VS Code is updating the clojure-lsp server. You can try reproduce it in a minimal file while observing the clojure-lsp message logging.

otwieracz09:01:13

What do you mean by updating the clojure-lsp server?

pez09:01:13

I’m thinking that when the file changes, the clojure-lsp server needs to know this and that if this update doesn’t happen, then the analysis will be on the old content.

otwieracz09:01:49

Even after I make further changes to this file, save it, etc - the message is still here.

pez09:01:47

Have you checked the clojure-lsp message log?

otwieracz09:01:31

I don't see such output tab.

pez09:01:33

Check your clojure.trace.server setting.

otwieracz09:01:38

I should look at this one?

pez09:01:40

Yes, that’s the one. (Though I do not know what to expect to be there, but maybe we can form a hypothesis from what we see there.)

otwieracz10:01:23

Log is not really helpful for me without background, but my guess is:

otwieracz10:01:54

• Calva asks LSP for info about currently edited symbol • LSP responds with, for example, invalid symbol json/read-tr • After the fix is made, Calva repeats the ask for this symbol, no errors returned this time but old message is still left there.

otwieracz10:01:33

All the errors I am seeing are errors from last edit before the fix.

pez10:01:07

It’s not really Calva doing this. Calva role is that it introduces VS Code and clojure-lsp: “Hi VS Code, say hello to clojure-lsp. clojure-lsp, this is VS Code.” And then Calva leaves the conversation and lets them talk to each other. This is probably VS Code failing to invalidate some cache properly. See if you can find any issues about it on the vscode repository. It probably isn’t Calva/clojure-lsp specific.

pez10:01:19

One more thing you can check is if the Problem pane has the error. If not, it could be Error Lens that is the problem.

otwieracz10:01:21

Yeah, definitely. It's also failing in non-clojure files.