would there be interest in the "Restructure Keys" working for :strs and :syms?
what does it do normally? (never used it)
if you have (let [{:keys [a b c]} foo] (some-call a b c)]), it'll change to (some-call (:a foo) (:b foo) (:c foo)), and there's a sister action that does the reverse called "destructure keys"
ok cool
it only works with :keys but i ran into a situation where i wanted to switch from (let [{:strs [a b c]} foo] (some-call a b c)]) to (some-call (get foo "a") (get foo "b") (get foo "c"))
makes sense. I don't think clj-kondo keeps track of strings though, so might not be as easy as keywords
ah good call
I guess a workaround to this could be to let lsp first rename a (and others) to lsp_str$a etc. then let lsp rename :strs to :keys . Then do the Restructure Keys (but using get instead of keyword calls...) and then change back the :keys to :strs and the local names to a etc. But seems like a huge workaround
no sorry, then remove the :keys
yeah, i'd have to look at it, but gotta make sure it's worthwhile first
this is funny, I just learned about :strs existence today, what are the odds of a question about it in the same day
but yeah, sounds nice
yeah, there's :keys, :syms, and :strs for the 3 primary key types lol
and clojuredart has :flds
(let [{:keys [a b c]
:syms [d e f]
:strs [g h i]} {:a 1 :b 2 :c 3
'd 4 'e 5 'f 6
"g" 7 "h" 8 "i" 9}]
[a b c d e f g h i])
; [1 2 3 4 5 6 7 8 9]
@nbtheduke do you have a minimal example of a initial code, then you apply the command/code action and the result
ah nice
ah yeah it might not matter if it's a keyword or not, since this works via locals
and those are tracked in kondo
yes, that's what I was thinking
@nbtheduke feel free to open a issue with a clear exampel of before and after applying the command, it should not be that hard to support that
one quick question about design here... any reason to not have clojure.specs for (at least) clojure-lsp/db ns? I'd like to contribute for having them if it could be interesting for the project
clojure-lsp.db was always a internal thing, changing frequently, so it was never meant to be used externally. What we should do is have an adapter layer if we expose it, so we can maintain and avoid breaking changes, that layer may make sense have a spec