Open benjamin-asdf opened 2 years ago
Sounds good. @ericdallo: does clojure-lsp do a similar thing?
Yep, clojure-lsp completion return all known keywords on local buffer and if namespaced/aliased bring it corresponding namespace keywords as well
Do you mean, if namespaced, then global completions instead of only local buffer?
Yes
Also :require
and such. I'm guessing this will be covered automatically but mentioning it.
@borkdude do you have an idea how to go about implementing this?
In jvm cider it gives you all keywords loaded
How does JVM cider do this?
Turns out is depends on https://github.com/alexander-yakushev/compliment it has a namespace for keywords.
(import java.lang.reflect.Field)
(def keywords-table
(memoize
(fn []
(let [^Field field (.getDeclaredField clojure.lang.Keyword "table")]
(.setAccessible field true)
(.get field nil)))))
Oh.. what a gory hack! :)
Maybe it is possible to use this compliment library. It seems to be advanced yet small.
with bb nrepl. Try to complete some keyword that you know sci already evalved. In jvm cider it gives you all keywords loaded. This behaviour is enjoyable in my opintion. It allows me to for example eval aws/ops once and then have complete for all the keys.