I want to have a command that list all distinct keywords (both qualified and unqualified) in current project. The goal is to pinpoint typos and have an overview so I can improve their names for better semantics.
Some regular expressions won’t help much because of shorthand syntax like #:foo{:bar 1} or ::some-key.
Edit: And now I realized it’s not good enough either, because for (let [{:keys [a b c]} nil]) it reports #{:keys} instead of #{:a :b :c}. I guess it might be worth looking into tools.analyzer?
I was thinking that it should be possible to query (ns-interns 'your.ns) and (clojure.walk/postwalk ...) over that, but I couldn’t find any source (form) access from the namespace object. So I think we have to go through files, as @vlaaad is showing.
I would be interested in hearing thoughts on how this should be accomplished!
…
CIDER is able to autocomplete keywords within a project. Isn’t that just what we want? “Please show me all loaded keywords”? Perhaps filtered on the namespace where it was referenced?