Fork me on GitHub
#cider
<
2022-11-12
>
Drew Verlee01:11:19

is there a way to get information about a dep i have added to my deps.edn, after i have started my nrepl, but before i require it? For example, will something tell me the required expression thats needed e.g (require '[clj-http.client :as client]) . Or do i have to go to github, like i have been dong all these long years. No be clear, this isn't a major headache, just asking in case there is some tiny productivity win i'm missing out on.

vemv01:11:48

haven't heard of any such feature however, it'd doable (implementable) like this: • add dep • start nrepl • identify the .jar corresponding to the dep within the classpath that is found at runtime • search for README.md within .jar • open it in emacs, maybe jumping directly to the first (require call (using regex)

👍 1
Drew Verlee01:11:25

thats super helpful. I need to start recording these todo items in a list so i can rank them.

vemv01:11:45

🍻 . looking forward to a few PRs :) this one sounds to me like a nice one for clj-refactor.el (which has some project.clj / deps.edn goodies)

vemv03:11:46

sadly I was wrong - README.md files aren't typically bundled in .jars (project.clj files are, which is mistook them for)

vemv03:11:59

however you can do something pretty similar: • add dep • start nrepl • identify the .jar corresponding to the dep within the classpath that is found at runtime • identify all the .clj files contained within that .jar • sort them by likelihood of being the "main" ns (e.g. foo.core), and let the user choose one of them, using Elisp completing-read . • finally, copy the selection to the clipboard so that one can paste that into an actual ns buffer (since the whole op was triggered from project.clj)

👀 1
Drew Verlee22:11:33

I'll give this a try over the weekend, thanks for the head start.

cider 2