Fork me on GitHub
#calva
<
2023-10-05
>
hkjels07:10:10

After completing a clean installation of Visual Studio Code, the Calva extension, and Clojure-lsp, I consistently encounter server connection issues when opening a Clojure workspace. The error messages are as follows: [Error - 9:34:36 AM] Connection to server got closed. Server will not be restarted. [Error - 9:34:36 AM] Server initialization failed. ◦ Message: Pending response rejected since connection got disposed ◦ Error Code: -32097 I'm looking for guidance on identifying potential causes for these issues. Are there any known conflicts or bugs that could be responsible for this behavior? Any additional components that I should consider checking or updating?

hkjels08:10:08

Using clojure-lsp.exe directly like in the explanation here: https://clojure-lsp.io/troubleshooting/#server-is-not-initializing works just fine

hkjels08:10:00

My colleagues are not facing this issue, although we have pretty much identical setups. We have also compared java versions now

pez10:10:14

Sounds a bit like you are running into this issue: https://github.com/BetterThanTomorrow/calva/issues/2251 Which clojure-lsp.exe is it that works using directly? You could try telling Calva to use that one and see if that works. There’s a setting calva.clojureLspPath for this. It’s set to latest by default, but if you set an absolute path to a binary, Calva will use that instead (after a restart of clojure-lsp, which you can do via a command or via the status bar button).

hkjels10:10:51

Looks like it. Thank you

hkjels11:10:30

Before the issues with clojure-lsp, I realize that I get one more error:

Internal error
Source: Calva: Clojure & ClojureScript Interactive Programming (Extension)
Is it possible to make these errors more verbose?

pez11:10:51

Could be. I have no idea where this particular one comes from, though. Internal error… could be clojure-lsp… Could also be that we write the more extensive info to the console at that point.

Georgi Stoyanov09:10:53

Hi guys. Recently I noticed something: clojure-lsp is using the swap memory a lot. I’m not really sure is it on my machine only, or it’s by design. First photo - my free ram memory and the swp. Then I run sudo fs_usage | grep swapfile and mainly the clojure-lsp is the one that is writing. When I opened the activity monitor I have like …. 10 clojure-lsp processes that run and takes a lot of memory. Is there a way for optimization? btw I have a lot of vscode instanaces running (we have a lot of projects) but not actively develop code with them, they are opened just for reference or investigation

pez10:10:49

Hi! Calva will start a clojure-lsp process for each VS Code window with a Clojure project in it. You can tell Calva to not do this automatically, and then start it manually (there’s a status bar button that makes this easy).

Georgi Stoyanov10:10:02

Thanks @U0ETXRFEW I saw that one, but I was wondering is there another way around, cause the LSP is really good and useful. It will be a shame to not use it 😄 I saw in couple of places that there’s “alternative” of that, the guys were mentioning “repl tooling”. Do you know what they are talking about and where I can read more about it?

Georgi Stoyanov10:10:31

btw if someone happens to be interested in that topic, here’s a ticket for that feature which is still open https://github.com/clojure-lsp/clojure-lsp/issues/280

pez10:10:49

Calva will fall back to repl tooling if clojur-lsp is not present. Some things won’t work, but when you miss clojure-lsp, you can always start it.

🙌 1
Georgi Stoyanov10:10:23

@U0ETXRFEW last one - is there a way to optimise the consumption of the memory with graalvm for example? btw here is a thread about a setup for that issue. Sorry that I asked before actually finish my search https://clojurians.slack.com/archives/CBE668G4R/p1674579601969449?thread_ts=1674566844.014189&amp;cid=CBE668G4R

pez10:10:16

Not sure which issue the thread is about? 😀

pez10:10:15

If the question is if I know how to tweak clojure-lsp memory consumption, then I don’t. But arranging the projects so that one clojure-lsp can server them all will have you start many fewer. And it will also create a better repl experience, if you also start the repl on that top level.

🙌 1
ericdallo11:10:16

@U03SN3M2W0Y, there is a perf improv I'm about to make in clojure-lsp related to Graal but should improve mostly CPU, about memory, that's one of the hardest things to improve, one way is to disable some features like java analysis, adding :java nil to your .lsp/config.edn may help

🙌 1
Georgi Stoyanov11:10:14

Thank you guys 🙂

Alexander Kouznetsov22:10:36

Can we disable clojure-lsp and calva formatting options for files that have merge conflicts? I found LSP is blocking gitlens tools “accept current change | …” thingy from appearing and copy paste performs unexpected formatting breaking conflicts structure.

pez22:10:21

What’s “clojure-lsp and calva formatting options” here?