Fork me on GitHub
#cursive
<
2021-03-14
>
Azzurite18:03:24

what has to happen for automatic require/autocomplete to work? I don't understand why it's picking up some libraries I've been using but not others

mikejcusack20:03:43

Are the maven repos indexed?

Azzurite18:03:34

and new ones are never picked up

dazld21:03:36

when loading a file/namespace into the repl, is there any way to make cursive reload any namespaces that require that one too?

mikejcusack21:03:33

Best thing is to use clojure.tools.namespace.repl/refresh for that

👌 3
dazld21:03:19

thank you, that looks perfect.

borkdude22:03:30

you can also just use (require '[the-ns] :reload-all)

borkdude22:03:39

in the repl

dazld22:03:32

thanks, i’ll give that a go too

Azzurite22:03:39

and also cursive has the possibility under "tools -> REPL" to add a REPL command, i.e. code that gets executed in the current REPL, which you can then bind to a keyboard shortcut or add to a macro

👆 3
dazld23:03:54

@U0567Q30W thanks - almost exactly what I wanted, but unfortunately the other way around - I want to reload namespaces that depend upon the one I’m working on - I’m working on some macro related stuff, and want the consumers of the macro to reload, so they get the new behaviour. it’s pretty dull having to go through each of the consumers and reload them..

dazld23:03:26

The clojure.tools.namespace.repl/refresh approach and the (require '[the-ns] :reload-all) approaches both didn’t end up working out. I think the require... approach is reloading dependencies of the namespace (..right?), so not quite right, and the namespace.repl/refresh thing just didn’t seem to work - suspect it was a problem with retained vars in some places, but even restarting the system as part of it didn’t work.

dazld23:03:35

(wall of text, apologies)

cfleming23:03:56

Yeah, there are some other use cases like this too - things like updating protocols and multimethods.

👍 3
dazld23:03:40

all three of those are some of the most fun bits of clojure too!

dazld23:03:48

As a suggestion, some kind of tree reload might be great, both backwards with dependencies, and forward with dependents.

cfleming23:03:38

Yeah, I can see that being useful. It would be pretty easy to accidentally reload your whole app, though, although I suppose that’s what you want if you’re changing some fundamental macro at the bottom of the pile.

dazld23:03:27

It’s a trade off, for sure.

borkdude23:03:09

Reloading your entire app is pretty easy: (require your.main :reload-all)

borkdude23:03:39

I use this a lot from the REPL actually when I make such changes

dazld23:03:46

Have unplugged now, but will try that later @U04V15CAJ thanks

dazld23:03:45

Even a single level of dependents would be handy to reload, without traversing the whole tree..

dazld23:03:05

“Reload direct dependents” would work great, the more I think about it. If I know I need to go further, navigate and execute that command iteratively is straightforward.

mikejcusack20:03:35

There is also clojure.tools.namespace.repl/refresh-all , which seems like what you're looking for