This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-31
Channels
- # announcements (20)
- # asami (14)
- # aws (6)
- # babashka (15)
- # beginners (83)
- # biff (6)
- # calva (93)
- # cider (3)
- # clj-kondo (21)
- # cljdoc (106)
- # cljs-dev (32)
- # clojure (165)
- # clojure-dev (78)
- # clojure-europe (54)
- # clojure-italy (9)
- # clojure-nl (9)
- # clojure-norway (24)
- # clojure-uk (4)
- # clojurescript (6)
- # community-development (2)
- # conjure (2)
- # core-typed (14)
- # datahike (4)
- # datomic (2)
- # emacs (40)
- # events (1)
- # fulcro (11)
- # graalvm-mobile (29)
- # graphql (8)
- # honeysql (19)
- # java (1)
- # jobs (1)
- # lsp (232)
- # malli (5)
- # membrane (112)
- # nextjournal (11)
- # off-topic (63)
- # portal (12)
- # re-frame (6)
- # reagent (3)
- # reitit (4)
- # rewrite-clj (2)
- # shadow-cljs (25)
- # tools-deps (6)
Released clojure-lsp 2022.03.31-14.21.14 with a long waited feature: Java support 🎉 🚀
• Add java class find-definition support, decompiling .class files when available. https://github.com/clojure-lsp/clojure-lsp/issues/762
• Add JDK source discoverability feature, searching for installed JDK for later analyze with clj-kondo and support java classes interop.
• Add
:java :download-jdk-source?
setting to download JDK source after startup if not cached before globally or found locally. Disabled by default.
• Avoid high CPU usage and freezes by more efficiently finding referenced files to notify on file change. https://github.com/clojure-lsp/clojure-lsp/issues/844 https://github.com/mainej
• Bump clj-kondo to 2022.03.10-20220331.135739-32
improving java analysis and fixing a critical regression for re-frame. https://github.com/clojure-lsp/clojure-lsp/issues/888
This is a release with few but huge features/improvements, we now support find definition of all types java classes:
• Java classes with source, going to top of the .java
file
• Java classes without source, making clojure-lsp decompile the .class
into a cache folder and then going to that decompiled .class
• JDK classes, clojure-lsp will try to find the source in the installed system's JRE, otherwise download OpenJDK source if a setting is enabled, Check https://clojure-lsp.io/settings/#java-support
For now , we support java classes only and not methods, soon we intend to add support for completion, documentation and methods support 🤞
Also, Thank you @borkdude for the help on clj-kondo side!
Besides that we had huge performance improvements on the way we analyze changed files, improving huge files/projects like https://github.com/Clojure2D/clojure2d
This release was supported by https://www.clojuriststogether.org/

Hi all - after the announcement of the new version, I installed clojure-lsp from this guide via emacs https://emacs-lsp.github.io/lsp-mode/tutorials/clojure-guide/ - I tried to jump to definition for a Thread/sleep
call and it didn't seem to work - what's the way to check the version of clojure-lsp and see if I have the one required for this functionality?
Check the https://clojure-lsp.io/troubleshooting/#server-log to make sure JDK was installed properly, more info https://clojure-lsp.io/settings/#java-support
I get this:
$ bash <(curl -s ) --dir ~/Dropbox/bin
Downloading to /var/folders/2m/h3cvrr1x4296p315vbk7m32c0000gp/T/tmp.F7hhsRuJ
Moving /Users/borkdude/Dropbox/bin/clojure-lsp to /Users/borkdude/Dropbox/bin/clojure-lsp.old
$ clojure-lsp --version
clojure-lsp 2022.03.31-14.21.14
clj-kondo 2022.03.10-SNAPSHOT
Hmm, no binary found on path - assuming clojure-lsp --version
should be called from a standard shell - maybe the Emacs installed one does some fiddling with paths to install an emacs visible only one? I guess I can try doing the bash install and set lsp-clojure-custom-server-command
?
I suggest you follow the installation instructions https://clojure-lsp.io/installation/
if you installed via emacs with lsp-install-server
, you can try lsp-clojure-server-info
to get the info if clojure-lsp is already running in that project
is there any emacs-side settings required to enable the java support? I see a note in the release about a :java key - not sure if that belongs in a clojure-lsp rc file or something? or in emacs
@UKFSJSM38 Thread/sleep
also doesn't navigate to anything for me btw, have you implemented that Java source download?
yes, behind a disabled flag as mentioned https://clojure-lsp.io/settings/#java-support
[1;31mjava.nio.file.NoSuchFileException[m: [3m/private/tmp/project/https:/raw.githubusercontent.com/clojure-lsp/jdk-source/main/openjdk-19/reduced/source.zip[m
also I did not configure lsp to download it - you said it defaults to not downloading - so why is that appearing in the logs? ;)
another minor point, why didn't you use XDG_CACHE instead of XDG_CONFIG for this cached file?
not sure, We already have XDG_CONFIG
use for other configs, I thought it would be a good place
anyway, it should not say it's downloading unless you have :java :download-jdk-source?
set
could you paste the server logs? after server starts, there should be logs with [JAVA]
tag
well, it seems it tries to download from github right? but it appends my file system path before the url :)
that's why I found it surprising that I saw that. I haven't changed anything to my config
specifying the URI on the setting should do the tricky, but without that it probably will fail :/
I think zipfile clojure deps is broken on master (release too prolly) getting jar: scheme back for uri. Could someone else confirm?
When I go to def of a dependency, I'm getting the wrong uri scheme back.
I expect zipfile://...
but get jar:file://...
will work on that fix and make a hotfix @U0BUV7XSA
the external-analysis
and project-analysis
test in queries_test.clj
looks like they aren't actually testing dependency-scheme
The code and docs are also pretty confused between whether it should be zip
or zipfile
(i think it just checks = "jar"
so this is less urgent but was confusing to troubleshoot)
@U0BUV7XSA just to make sure, this happens when you find a definition of a external clojure/java file?
@U0BUV7XSA I'll send the fix, but I think java analysis won't work for zipfile users (only vim?) for now 😔 We should think later how to fix that
LMK if you have any suggestion regarding the insurmountable decompiled for zipfiles
yeah, good point, will think a little more about that, meanwhile I'll release the hotfix and leave that for next release which I don't want to delay that much
@UKFSJSM38 master is fixed
I guess, for my own workflow. Needing to read java (compared to clojure) sources is very rare. But, method completion
and hover
(with docs) will be sublime. So I'm not too concerned with zipfile compatibility there.
yeah, agreed, but I'll try to fix that, vim users use zipfile right? so more people may want to have java support just like other editors
what works fine? are you able to go to definition of that java class definition or you manually opened it from cache?
so java.* packages work, cause it's redirecting me to the .cache. but like com.cognitect.* doens't
@U0BUV7XSA try some lsp4j classes that also has source code
@U0BUV7XSA I was wondering, would work make vim always use "jar" dependency-scheme? so all clients follow same rules
anyway, I intend to investigate that tomorrow or by the weekend, making it work for zipfile too
On the released version, I remove the .lsp/.cache directory, open up a file containing a java jar, goto definition and it gets decompiled and opens up for me on vim
on master, same process, but [Server] java.net.MalformedURLException: unknown protocol: zipfile
what does :java :download-jdk-source?
mean for the config?
As mentioned https://clojure-lsp.io/settings/#java-support, it tells to clojure-lsp to download the source of JDK if not found locally
sorry, I meant "what does this mean for the format in the config"
I don't understand how two keywords in a row translates into a setting in the config
I didn't ask very well 😬
ok, cool
that was my guess after thinking on it for a minute or two
thanks!
I do wish it was more common to have a list of all the possible options with links out to their documentation
I realize that's a lot of work, though
there is: https://clojure-lsp.io/settings/#all-settings > https://github.com/clojure-lsp/clojure-lsp/blob/master/docs/all-available-settings.edn
ohhhhh
well then
should those all be keywords and not symbols?
and having 2+ on a line for name means they're nested
oh nice, it links to an edn file too
thanks for your patience here, eric
I wonder if there's a better way to convey nesting. I'll have to think about that
Does all-available-settings.edn translate into something? Like, a ~/.config/clojure-lsp.edn ? Or a per-project file? (if so, what name? Just put in deps.edn?)
well, I did something about the things I knew were pretty simple fixes https://github.com/clojure-lsp/clojure-lsp/pull/898
there are a couple global locations you can put a global config for clojure-lsp
and, obviously, for individual projects as well but those are the global ones
hmm maybe something like:
`:java`>`:download-jdk-source?
`
or an eql query?
{:java :download-jdk-source?}
no, that's more confusing
well, it's clojure-lsp, we could be cute about it
change the column name from "name" to "get-in" and use the get-in syntax for the nested values
@U02N27RK69K we don't add :
to settings on that docs because it's possible to pass docs via initializationOptions as json :/
well, :clean already had that
whoops
I can think of some ways to do this that are interesting
a toggle for showing json vs edn, using "jq" as the header for json and "get-in" for edn
or just a column for each
¯\(ツ)/¯
I'll close my PR
it's the consistency (or inconsistency) that confuses me
the docs throughout generally use keywords and edn, but not in the table (except for :clean)
does an option like :download-jdk-source?
translate to "download-jdk-source?"
in json?
but I think using the json it's pretty uncommon nowadays with clojure-lsp file config
should I re-open my PR then?
oh, you re-opened already 🙂
I'll bet I can make it a toggle at some point here, purely in js
oh, no, I'd have the js translate the edn to json
although I'm not sure how you'd handle `
#re ".*"
or symbols
initializationOptions are json settings that usually editors send, so they use just one or two settings, nothing advanced
example: https://github.com/emacs-lsp/lsp-mode/blob/master/clients/lsp-clojure.el#L397-L398
maybe it pays to just have the json listed in that column for those specific values
as a way of saying "these are supported in json"
yeah, I think we should support all as json, so I'm okay adding a note somewhere, maybe on initializationOptions section saying that a json is expected and ifsomething not works, fix on clojure-lsp
I think a lot of this could be replaced by merging in ~/.lsp/config.edn
(which I think we do now?) or ~/.lsp/profile.edn
Then dropping support for config coming from initializationOptions since it really does confuse things.
The way I thought about initializationOptions are for global or user specific settings whereas project/.lsp/config.edn
are shared, project specific.
Not sure, dependency-scheme is required since all emacs users should send jar, same for Calva
That's my point regarding of that setting, would be possible make vim (the only editor that uses zipfile AFAIK) to use jar as well?
there's some nice benefits to it, for clojure files you can actually edit within zipfile after jumping in.
Don't use it often, but when it's needed to debug something within it's really really nice.
like this?
{:java {:download-jdk-source? true}}
I had a pretty interesting CPU spike just now. The clojure-lsp processes weren't busy at all, also no clj-kondo active in my activity monitor, but emacs was locked up at 100%.
All I did was type in an empty clojure buffer: (def ^{:ma_})
, at the underscore I tried to write :macro
it could be flycheck invoking clj-kondo over and over, but I didn't see the clj-kondo process at all
I occasionally have random freezes of emacs too. Usually nothing is using much CPU, it just stops responding. But, this is an issue as old as time. https://www.reddit.com/r/emacs/comments/k7cku8/when_emacs_hangs_what_do_you_do/
Still, it's pretty pretty rare to me some emacs hang that hitting C-g multiple times doesn't solve it 😅
Debugger entered--Lisp error: (quit)
bounds-of-thing-at-point(sexp)
clojure-match-next-def()
imenu--generic-function(((nil clojure-match-next-def 0)))
imenu-default-create-index-function()
imenu--make-index-alist(t)
which-function()
which-func-update-1(#<window 3 on foo.clj>)
which-func-update()
apply(which-func-update nil)
timer-event-handler([t 0 0 500000 t which-func-update nil idle 0])
so just clojure-mode
, from docs:
> Scans the buffer backwards for the next "top-level" definition.