I believe it's only able to be done project-wide.
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
and new ones are never picked up
Are the maven repos indexed?
when loading a file/namespace into the repl, is there any way to make cursive reload any namespaces that require that one too?
You can also use Tools | REPL | Sync files in REPL, as recently discussed: https://clojurians.slack.com/archives/C0744GXCJ/p1615790200178200?thread_ts=1615527556.163100&cid=C0744GXCJ
@cfleming 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..
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.
(wall of text, apologies)
Yeah, there are some other use cases like this too - things like updating protocols and multimethods.
all three of those are some of the most fun bits of clojure too!
As a suggestion, some kind of tree reload might be great, both backwards with dependencies, and forward with dependents.
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.
It’s a trade off, for sure.
Reloading your entire app is pretty easy: (require your.main :reload-all)
I use this a lot from the REPL actually when I make such changes
Have unplugged now, but will try that later @borkdude thanks
Even a single level of dependents would be handy to reload, without traversing the whole tree..
“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.
https://clojure.org/guides/repl/enhancing_your_repl_workflow#writing-repl-friendly-programs
There is also clojure.tools.namespace.repl/refresh-all
, which seems like what you're looking for
Best thing is to use clojure.tools.namespace.repl/refresh
for that
thank you, that looks perfect.
you can also just use (require '[the-ns] :reload-all)
in the repl
thanks, i’ll give that a go too
yes
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