Looks like the nightly builds are broken -- Calva downloads but cannot start the nightly LSP: [Trace - 2:01:55 PM] Sending request 'initialize - (0)'. [Trace - 2:02:35 PM] Received response 'initialize - (0)' in 39918ms. Request failed: Internal error (-32603). [Error - 2:02:35 PM] Server initialization failed. Message: Internal error Code: -32603 [object Object] [Error - 2:02:35 PM] Clojure Language Client client: couldn't create connection to server. Message: Internal error Code: -32603 [object Object]
I've reverted to latest instead and that works fine.
https://github.com/clojure-lsp/clojure-lsp-dev-builds/releases/tag/2025.10.21-15.26.33-nightly seems to work for me
any other stacktraces?
oh not really, there is a exception happening
it may be related with the clj-kondo bump, let me check the logs
😨
clojure.lang.ArityException: Wrong number of args (3) passed to: clj-kondo.impl.config/ns-groups
java.util.concurrent.ExecutionException: clojure.lang.ArityException: Wrong number of args (3) passed to: clj-kondo.impl.config/ns-groupsah, from which file?
humm I recall we are calling that from clojure-lsp
oh really. well, it's not a public function so I warned you ;)
this is a backwards compatible code for the unused-public-var linter
I guess you can copy paste the old version.
let me check
but note that I optimized this function so you may want to do the same
hum yeah, for now I will copy the previous one
doesn't look simple to optimize on lsp side
copy the previous one. for the other function from clj-kondo.IMPL.config you can use the public API: clj-kondo.core/merge-configs
;-)
done! testing local
btw it's pretty easy to optimize using memoize, but I restricted memoization per run! invocation so you don't get any memory leaks
makes sense, I may optmize with a simple memoize too
I don't know how many times setting-for-ns is called, but if it frequently then optimizing is certainly worth it
looks like it is called almost for every var
in the unused-public-var linter
yes, indeed
this is my version of re-find memoized:
:re-find-memo
;; memoized version of re-find that takes a pattern string and a match string
;; regex creation is cached
;; matches on regex are cached
#_{:clj-kondo/ignore [:discouraged-var]}
(let [re-pattern-memo (memoize re-pattern)]
(memoize (fn [pattern-str file-str]
(re-find (re-pattern-memo pattern-str) file-str))))
Note that I cache both regex creation regex matching.
Also note that re-find-memo takes two strings rather than a regex + stringand then I use this version of re-find in ns-groups. which is why I needed the extra argument
interesting
you could define a global version of this, but I'm fearing that it will eat up memory over time
or you could just factor our the usage of ns-groups from your functions so you only call it once per namespace or so
instead of per var
we could memoize per ns I guess, that's the best we could do without too many changes
@ericdallo cljfmt has a new version + feature: https://mastodon.social/@weavejester/115414031176979588
Eric already had a message about it in an issue 😄 machinations are underway.
Ah yeah, I was following that issue for some years hehe glad it was done! Will bump it
which issue was it?
On mobile rn, but it was the vertical alignment feature
It's not everyday you see a 11y issue fixed :) awesome
.https://github.com/clojure-lsp/clojure-lsp/issues/2129#issuecomment-3421981150
Ah yeah, that one too :)
@borkdude any plans for kondo release? Im thinking of cutting a new LSP one in the following days
yeah, I want to work on some issues Thursday
and then doing a release probably
clojure-lsp Latest clojure-lsp nightly bumps cljfmt supporting vertical map/let alignments a feature asked for a long time! Kudos @weavejester Personally I'm don't like to vertical align hehe but it's good to have this option now!
@pez that may be a good addition to calva, I don't recall if calva has workarounds to make that feature work, if so, you can maybe consider relying on cljfmt only now 🙌
I think this means we can get rid of the copy of an old fork of cljfmt we use in Calva for this today.
@pez, @ericdallo you may also be interested in the realign-form function that I've just added to cljfmt 0.15.2. This function will take a rewrite-clj parsed form and aligns the columns of just that structure - so it won't recurse down and align the children's columns as well. This could be potentially useful for a code action of some kind.
As an example, if realign-form is called on this map:
{:x {:aaa 1
:b 2}
:yyy 3}
It'll realign to:
{:x {:aaa 1
:b 2}
:yyy 3}
Note that the child map is not automatically aligned.for sure! would be nice to have 2 code actions for that:
• Align vertically this form
• Des-align vertically this form (?) the other way around
I see myself wanting the latter one personally, like see a vertically aligned code and want to change to not be aligned like that
Ah, I didn't think of doing it the other way. I guess that's just a case of removing all non-indenting consecutive spaces. I'll add a unalign-form function tonight or tomorrow.
exactly! I mean, this whole vertical alignment feature is really polemic, each person has its own tastes, so I think we should give both options, align or not, convert or not
I can honestly see myself using both. I tend to align into columns only when there won't be too much whitespace (i.e. when the key lengths are similar).
yeah, I can see how convenient it may be for some cases!
:remove-multiple-non-indenting-spaces? does essentially that no?
Yes, but recursively.
I am also not a fan of vertical alignment and I had great success normalizing codebases with that option :)
Glad to hear it! In this case, unalign-form would be a non-recursive option for removing vertical alignment for a single form via a tool like Clojure LSP, Calva, CIDER, etc. The use case is for people who might want to align some forms but not others.
And of course it turns out to be more difficult than I expected...
oh right