Fork me on GitHub
#cider
<
2017-10-10
>
bozhidar04:10:38

@andrea.crotti No. Jump to definition uses some location metadata that’s available just for vars. In theory doing this won’t be very hard - we can just try the regular resolution, fail and see if we’re in a let and try going higher and higher in nest lets.

bozhidar04:10:12

> Hi! I’m using cider with re-frame and figwheel, so I have a lot of definitions like (reg-sub :my-event ...) is there any way to navigate to that keywords using cider?

bozhidar04:10:43

@achikin CIDER still doesn’t have “find references” functionality built-in, but clj-refactor.el has it.

bozhidar04:10:30

> So with cider there’s a function you can add to you config file named cider-annotate-completion-function and it says that the 2 arguments it takes are the abbreviations from cider-completion-annotations-alist (I configured that already) and the namespace that candidate is from. So do I put (cider-annotate-completion-function "c" "clojure.core") etc etc?

bozhidar04:10:48

The abbreviations indicate the type of something - function, macro, etc.

bozhidar04:10:27

Basically for each item on the completion list this the function receives the type of the thingy and it’s namespace. The default behaviour in just to concatenate those, but you can define a new function that does something fancier. But you’ll also have to change the logic for figuring out the type of candidates.

bozhidar05:10:12

The types come straight from the middleware though.

(defun cider-completion--parse-candidate-map (candidate-map)
  "Get \"candidate\" from CANDIDATE-MAP.
Put type and ns properties on the candidate"
  (let ((candidate (nrepl-dict-get candidate-map "candidate"))
        (type (nrepl-dict-get candidate-map "type"))
        (ns (nrepl-dict-get candidate-map "ns")))
    (put-text-property 0 1 'type type candidate)
    (put-text-property 0 1 'ns ns candidate)
    candidate))
so this is not a change you can easily do locally.

bozhidar05:10:41

What you can do locally is to add some if in the annotation function to handle clojure.core differently.

bozhidar05:10:49

P.S. We already use c for classes.

andrea.crotti12:10:43

ah nice @bozhidar should I open a ticket to keep track of that?

andrea.crotti12:10:57

I can also try to do it myself possibly

bozhidar12:10:22

@andrea.crotti That’s fine by me - especially if you try to tackle it yourself. 🙂