Hi! Is it possible to connect remotely to clojure-lsp? Usecase is that I have a machine which doesn't support the graalvm, but I can run clojure-lsp on a different box / a vm
Which machine is this if I may ask? You can use clojure-lsp as jar file as well, you don't need to use the binary necessarily
I'm running openbsd
see jar file here: https://github.com/clojure-lsp/clojure-lsp/releases/tag/2024.08.05-18.16.00
thank you!
I'm not sure if you need the standlone or the server one...
but @ericdallo knows
FWIW I always run clojure-lsp from source combined with clj-kondo from source (since I want to see my development changes locally).
How to do this, search on this page: https://github.com/clj-kondo/clj-kondo/blob/master/doc/editor-integration.md
for ~/bin/clojure-lsp-dev
but the jar file should work equally well if you want a released version
thank you that sounds exactly like what I wanted
I'll try and set it up
standalone is the way to go, you will lose performance compared with the graal one but it should work
It seems to be working but I still run into one issue. To detail the setup, the source code resides in the VM too (because it uses docker for a bunch of stuff), I use sshfs to access it, + port forwarding to access the nrepl from the host, all this works fine. However, the lsp seems to be stuck on "analyzing external classpath"
Yeah, pretty much it won't work, the support for remote code in clojure-lsp is not good
We rely too much on expecting local files, probably kondo too
you can maybe connect to the remote nREPL while editing files locally
Accessing the VM's nREPL from the host works fine if that's what you mean, and I think the lsp is treating this as local files (it first failed because it didn't get some dependencies and the error disappeared after a lein deps)
What I mean is you could check out the repo locally, but connect to the remote nREPL and evaluate your local files against the remote nREPL.
running java -jar clojure-lsp-standalon.jar --project-root ./ diagnostics works fine and relatively fast
This way you could just edit files locally and run lsp locally
Another way could be to use a decent terminal editor like emacs or vim and run that remotely
I am using emacs
ok, then you could run emacs remotely + the jar solution and edit remotely in an ssh or tmux session perhaps
but it seems like it's the diagnostics which runs out of memory when running from lsp-mode but runs fine when running from a terminal
BTW you can download the clojure-lsp artifact which is a wrapper for the standalone jar so you don't need to do that
Ok got it working!
Nothing super exciting, I had to set -XX:ReservedCodeCacheSize=2048m -Xmx6g