This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-05-16
Channels
- # announcements (22)
- # beginners (4)
- # biff (4)
- # cider (5)
- # clerk (3)
- # clojure (28)
- # clojure-chennai (1)
- # clojure-europe (23)
- # clojure-gamedev (7)
- # clojure-korea (5)
- # clojure-madison (3)
- # clojure-my (1)
- # clojure-nl (1)
- # clojure-norway (49)
- # clojure-sweden (7)
- # clojure-uk (4)
- # clojuredesign-podcast (14)
- # clojurescript (10)
- # clr (5)
- # cursive (4)
- # datascript (17)
- # datomic (2)
- # events (1)
- # garden (1)
- # introduce-yourself (2)
- # jobs-discuss (14)
- # lsp (23)
- # malli (14)
- # missionary (9)
- # off-topic (109)
- # overtone (7)
- # polylith (5)
- # releases (5)
- # shadow-cljs (7)
- # sql (13)
- # testing (30)
- # xtdb (10)
- # yamlscript (44)
I'm trying to get clojure-lsp
working with https://helix-editor.com and Babashka. I've created an empty file ~/Desktop/bb.clj
, and Helix starts up clojure-lsp
as soon as I navigate to the file. But I'm finding that the language server crashes immediately. I'm hoping to use the language server directly on a bb.clj
script, with no project or bb.edn
or anything. I thought that was appropriate use of Babashka.
Sorry if I'm doing something obviously wrong, this is my first foray back into Clojure in a couple years and I've forgotten everything. Here are the clojure-lsp
logs. It seems like some kind of uri
is missing, but I'm not sure what it's supposed to be.
2024-05-16T17:10:34.261Z INFO [clojure-lsp.server:627] - [SERVER] Starting server...
2024-05-16T17:10:34.308Z DEBUG [clojure-lsp.nrepl:21] - nrepl not found, skipping nrepl server start...
2024-05-16T17:10:34.321Z INFO [clojure-lsp.server:509] - Initializing...
2024-05-16T17:10:34.328Z ERROR [clojure-lsp.server:55] - Error receiving message: Internal error (-32603)
{:id 0, :method "initialize"}
com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine PosixPlatformThreads.java: 211
com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine PlatformThreads.java: 833
java.lang.Thread.run Thread.java: 1583
java.lang.Thread.runWith Thread.java: 1596
java.util.concurrent.ThreadPoolExecutor$Worker.run ThreadPoolExecutor.java: 642
java.util.concurrent.ThreadPoolExecutor.runWorker ThreadPoolExecutor.java: 1144
...
clojure.core.async/thread-call/fn async.clj: 486
lsp4clj.server/thread-loop/fn server.clj: 122
lsp4clj.server.ChanServer/fn server.clj: 260
lsp4clj.server.ChanServer/receive-request server.clj: 365
lsp4clj.server/pending-received-request server.clj: 181
...
clojure-lsp.server/fn server.clj: 520
clojure-lsp.shared/normalize-uri-from-client shared.clj: 546
clojure.string/starts-with? string.clj: 365
java.lang.NullPointerException:
I got this working. The issue was that I did not have a git repository initialized. clojure-lsp
is looking for rootUri
(`:root-uri` in codebase) to be sent along with the initialization. Helix does not send rootUri
if you're not in a git repo.
It would be great for there to be more help for the user here... I'm pretty used to language servers "just working" in Helix. It's possible this problem is on the Helix side (maybe Helix should know to send a "dummy" root path to clojure-lsp
?).
But I think think there's also an argument that clojure-lsp
should handle this gracefully. If Babashka is supported, opening a .clj
without a git repo is probably pretty common.
I'm off topic here but I'm curious what are you going to use for structural editing (paredit, parinfer) and repl driven development (eval'ing expressions from the editor to a running repl) with Helix or are you just opting to go without? I was under the impression there are currently no solutions for such things at the moment
> . Helix does not send rootUri
if you're not in a git repo.
That sounds like something to be fixed on Helix
clojure-lsp totally depends on project root which this is the only flag that tells it
Checking the spec this is indeed a optional field, we could make clojure-lsp ignore it and work as a "dummy" mode
I'm interested on Helix as well, but AFAIK it still doesn't support plugins, waiting for that support to give it a try
@UKFSJSM38 thanks for the reply. It could be a tough sell to get Helix to change their behavior with clojure-lsp
, I think they are pretty homogenous with their interaction with language servers.
I agree having clojure-lsp
pick "something" to use in place of an empty rootUri
(and maybe a warning for the user) would be very helpful here. Especially as Babashka encourages people to write one-off scripts.
@U9J50BY4C Great question. As for REPL eval, I've found a hacky but surprisingly pleasant workaround using tmux
. Here's the entry in my config.toml
:
[]
# REPL hack from:
e = [''':pipe-to tmux load-buffer - \; paste-buffer -dpr -t '{right-of}' \; send-keys -t '{right-of}' Enter''']
This gives tmux
the selected text I have in my Helix editor, and tells it to paste it in the adjacent tmux
window (and press Enter). Yes, the text has to be selected in Helix, but Helix natively has many tree-sitter-based structural movement/selection commands, so selecting my defn
block or whatever is pretty easy.
So I'm "kind of" opting to go without. It's obviously not the experience I had when I used Emacs, but I'm happy enough for now, and will adopt any improvements that eventually come with Helix's plugin system.Yeah, checking the spec it's expected to the server to handle a missing rootUri, I think clojure-lsp should handle it null and act as dummy but not crash, please create a issue for that
Here you go, thank you for the discussion! https://github.com/clojure-lsp/clojure-lsp/issues/1815
Having trouble downloading clojure-lsp for my new mac M2. I downloaded the latest "macos-aarch64" binary (don't see what I expected, which is macos-arm64) and tried to run it, but mac os won't allow me because it is unable to scan it for malicious software. Any ideas?
I think you can «un-quarantine» it: xattr -d com.apple.quarantine
That said, I have not experienced any problem with lsp binaries on MacOS, silicon or otherwise.
Try downloading it from the terminal with curl and unzip it also in the terminal. Do not open it with a browser or finder and you will bypass all of this stuff
Thank you both!
Or if already using Homebrew
brew install clojure-lsp/brew/clojure-lsp-native
Emacs is not able to find my downloaded clojure-lsp executable. Do I need to put it in a particular place?
for a sanity-check, I'm assuming which clojure-lsp
outputs what you'd expect?
hmm good point (new machine). thank you!
new fancy mac- im sure theres some wizardry going on 😄
If using lsp-mode then Emacs will prompt to download the relevant LSP server for you, so a manual install is not required.
https://emacs-lsp.github.io/lsp-mode/
If installing clojure-lsp manually, it should be on the execution path that Emacs is aware of (e.g. /user/local/bin
or .local/bin
(depending on your shell PATH
config)
There is also lots of information at https://clojure-lsp.io/
Emacs tries to automatically download but it never completes and reports nothing