I have a really silly question: If I'm just using clojure-lsp as normal in Emacs (i.e., letting it install itself automatically in .config/emacs/.cache/lsp
) do I get new versions as they come out, or do I need to clear my cache periodically to get new versions?
There doesn't seem to be an equivalent to lsp-java-update-server
or lsp-csharp-update-server
that I see?
I place clojure-lsp
in my ~/.local/bin
which is on the path accessible to Emacs and it seems to prefer that, and not download a separate version to .config/emacs/.cache/lsp
- this way I control the version being used, or I think I do 😉
I did do that originally, but that was when clojure-lsp wasn't automatically sorted by lsp-mode (it now offers to install it for you when you first open a Clojure project). I got tired of keeping that updated across the couple of laptops I use... Maybe I've just substituted one problem for another. :thinking_face:
ATM we don't have a automatic install, you can C-u lsp-install-server
to force download latest clojure-lsp
Perfect. Thank you!
File a clj-kondo bug relating to linting some cljc file https://github.com/clj-kondo/clj-kondo/issues/1148
👀
Thanks, I'll look into it
Thanks!
I found the issue. It has to do with redefining ->
while also using cond->
which expands into ->
but then it uses the wrong one... I'll fix it
in promise.cljc
Fixed with ebbf162bdf92702b662f7567afc5fa7b2fdd02af pushed to master.
Re-build clojure-lsp with latest clj-kondo, works like a charm!
Observing an error with latest lsp (could be co-incidental)...
What error?
It just spins, with the "initializing...." stuck
Oh, usually this happens when starting clojure-lsp manually and passing wrong json
it get's initialised by coc when I enter neovim with a clojure program
anything on /tmp/clojure-lsp.out
?
"languageserver": {
"clojure-lsp": {
"command": "bash",
"args": ["-c", "clojure-lsp"],
"filetypes": ["clojure"],
"disableDiagnostics": true,
"rootPatterns": ["deps.edn", "project.clj"],
"additionalSchemes": ["jar", "zipfile"],
"trace.server": "verbose",
"initializationOptions": {
"project-specs": [{
"project-path": "deps.edn",
"classpath-cmd": ["clj", "-Spath"]
}],
"use-metadata-for-privacy?": true,
"ignore-classpath-directories": true
}
}
}
Yes, lots of these...
2021/01/27 15:33:04 2639895 ERROR clojure-lsp.crawler Cannot find position for: new {:name new, :filename "/home/david/devel>
2021/01/27 15:33:04 2639895 ERROR clojure-lsp.crawler Cannot find position for: fn* {:name fn*, :filename "/home/david/devel>
2021/01/27 15:33:04 2639895 DEBUG clojure-lsp.main :initialize 6493 ()
(ignore the devel chop, that's just my terminal)
Those are expected
anything more related to the error?
Nothing much. this is the start of the session:
2021/01/27 15:32:57 2639895 INFO clojure-lsp.main Starting server...
2021/01/27 15:32:57 2639895 INFO clojure-lsp.main ====== LSP nrepl server started on port 43527
2021/01/27 15:32:57 2639895 INFO clojure-lsp.main Initializing...
2021/01/27 15:32:57 2639895 WARN clojure-lsp.db Could not load db path to '/home/david/development/workspaces/personal/clojure/kaocha/.lsp/sqlite.db': '/home/david/development/workspaces/personal/clojure/kaocha/.lsp' does not exist
2021/01/27 15:33:00 2639895 INFO clojure-lsp.crawler Analyzing 23 paths with clj-kondo with batch size of 1 ...
2021/01/27 15:33:03 2639895 INFO clojure-lsp.crawler Paths analyzed, took 3.68586 secs. Caching for next startups...
2021/01/27 15:33:04 2639895 INFO clojure-lsp.crawler Paths analyzed, took 0.4616381 secs. Caching for next startups...
then lots of those errors as mentioned above
Then on CoC
2021-01-27T15:32:55.059 INFO (pid:2639865) [language-client-index] - Language server "languageserver.clojure-lsp" started with 2639895
2021-01-27T15:33:04.394 ERROR (pid:2639865) [server] - uncaughtException Error: Header must provide a Content-Length property.
at qw.onData (/home/david/.env/vim/bundle/coc.nvim/build/index.js:25:2759)
at Socket.<anonymous> (/home/david/.env/vim/bundle/coc.nvim/build/index.js:25:2496)
at Socket.emit (node:events:379:20)
at addChunk (node:internal/streams/readable:313:12)
at readableAddChunk (node:internal/streams/readable:288:9)
at Socket.Readable.push (node:internal/streams/readable:227:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
2021-01-27T15:38:53.577 INFO (pid:2639865) [attach] - receive notification: openLog []
maybe it's coc itself?
Yep, server is initializing correct, so coc is sending a wrong json probably
check coc logs, on emacs lsp-mode, it has a buffer with requests and response
I trawled through the CoC issues and everyone who reports the content-length, the reply is "it's a bug of your language server"
hahaha :thinking_face:
now it worked.
hmmm, timing I suppose
tested latest with emacs and it works correctly too
thanks. I'll put it down to a startup timing issue
ah!
I'm not alone 🙂
Yeah, I had the same issue haha, I thought it was only me.
Updated the ticket.
I'll try to fix it tonight (couple of hours)
@snoe do you think just wrapping the kondo calls with with-out-str
should be enough?
not sure - it's really where the output is coming from.... maybe the wrappers in main
should do it
Oh, you mean wrap this run
?
https://github.com/clojure-lsp/clojure-lsp/blob/master/src/clojure_lsp/main.clj#L450
this is kind of hard to test since I cannot reproduce the issue with emacs 😞
Ok, I may have found the issue, it was my mistake, a forgotten println :man-facepalming: https://github.com/clojure-lsp/clojure-lsp/blob/master/src/clojure_lsp/crawler.clj#L103
I'll remove it and try the with-out-str on run to avoid errors like this in the future
Fixed on latest release @dharrigan, thanks for the report!
Thank you! 🙂
Yup works. New version available on Arch 🙂
:nice: :clojure-lsp:
ttfn! bed time!