compliment
compliment copied to clipboard
Recognise alternative let-like formats
Brief
The following vars:
https://github.com/alexander-yakushev/compliment/blob/a112bb85b748d4a34da89ee783e7c64d8183dab7/src/compliment/sources/local_bindings.clj#L6-L13
represent closed sets and typically only will work over clojure.core symbols. So if one uses e.g. my/let
, completion accuracy will degrade.
Proposal
In:
https://github.com/alexander-yakushev/compliment/blob/a112bb85b748d4a34da89ee783e7c64d8183dab7/src/compliment/sources/local_bindings.clj#L55
Instead of doing (first form)
(which will return let
, my/let
, etc), perform (-> form first name symbol)
. This way let-like-forms
will work as usual, but also admitting alternative mechanisms that share the name
but use a different namespace
.
Same for defn
, doseq
, letfn
.
Alternatives
Consumers could use alter-var-root!
over the mentioned vars, although that doesn't seem a clean thing to do (and would also have to account for different ns aliases: my/let
, com.domain.my/let
, etc - which is not a closed set)
Thanks - V
Hi, could you please check #77 first? Would it perhaps be enough if I merged something like that?
https://github.com/alexander-yakushev/compliment/pull/77
Actually, I agree with your point that it makes sense having it "for free" for symbols that have names exactly like let
and defn
. I mean, what's the worst that can happen? We guard ourselves against errors already, so at worst we might suggest some redundant locals within such macros, whatever.
I'll keep this open for now.
Ok nice!
I have a patch around, should be at hand