Fork me on GitHub
#cider
<
2016-09-07
>
jonpither13:09:33

Is it possible to do a find-usages on a unique arity of a fn?

jonpither13:09:53

i.e. (foo ([]) ([bar])) - > I want to do a find-usages on just the first?

jonpither13:09:58

Just wondering

benedek13:09:22

don't think so

benedek13:09:57

find usages just looks for the symbol occurrences

benedek13:09:30

should be possible with some extra logic I suppose but not sure really worth the effort...

jonpither14:09:08

is there a way to search for symbols?

benedek14:09:23

find usages does that

jonpither14:09:29

i.e. I want to know any time there's a symbol call foo in the codebase

benedek14:09:05

what do you mean by ‘symbol call’?

benedek14:09:29

simply (foo “bar” “baz”)?

jonpither14:09:47

you actually know the codebase in question @benedek 🙂

jonpither14:09:04

There's a map we pass around, and people get a key called geo out of it

jonpither14:09:24

playing with the idea of renaming/removing/deriving this

jonpither14:09:37

but if I search the entire codebase for the word 'geo' it gets painful

benedek14:09:04

ah you mean a keyword then?

jonpither14:09:05

so what I really want is to know all the places in the codebase where the symbol 'geo' is defined in code, i.e. as a destructured paramerer

benedek14:09:25

ah right. i see

jonpither14:09:27

i.e. (defn foo [{:keys [geo]}]

jonpither14:09:37

or (-> a-map :geo)

benedek14:09:41

nope, unfortunately that does not work i think

benedek14:09:26

if i remember right desctructuring in a defn is macro magic

benedek14:09:38

and we fail on that particular case i think

malabarba15:09:22

Yeah, all destructuring is macro Magic, I think. Both in fn and let.

benedek15:09:15

no idea if rename symbol works on the local level with destructuring even tbh — i mean inside a defn/fn

benedek15:09:44

you might want to try cursive @jonpither for this particular issue. there I said it 😉 let me know if that works (that might make me have an other look on this :D)

benedek15:09:24

ok. so it absolutely works on the local level for both let destructuring and param destructuring

benedek15:09:08

what does not work is searching for the same symbols (representing keys in maps) globally