BetterThanTomorrow / calva

Clojure & ClojureScript Interactive Programming for VS Code
https://marketplace.visualstudio.com/items?itemName=betterthantomorrow.calva
Other
1.68k stars 217 forks source link

expose disconnect hook in custom repl sequences #1065

Open alidcast opened 3 years ago

alidcast commented 3 years ago

context: I start a repl server separately and would like to disconnect to clean the build, rather than restarting the entire Clojure program.

Right now I'm just manually stopping Figwheel before disconnecting, but opening up issue to track this feature and perhaps can submit a PR when time allows, unless maintainers tackle this first.

Thanks!

bpringe commented 3 years ago

Hi! Can you explain what you mean by "disconnect to clean the build?" Or, maybe a step-by-step of your desired flow and desired effects would help me understand. Thanks!

PEZ commented 3 years ago

I think the main thing here is in the title of the issue. If we introduce a field like beforeCLJReplDisconnectCode in the connect sequence settin. Then the user can put some Clojure code there, for whatever clean up purposes and Calva will fire if off before disconnecting.

And maybe it makes sense to have a similar setting for the CLJS REPL?

alidcast commented 3 years ago

as Pez said, it's mainly about having a hook that's called prior to Calva disconnecting from repl. with this hook, users can handle their own build cleanup logic whereas right now the repl disconnects abruptly and so only restarting entire Clojure program works.

yes, ideally this would be for CLJ and CLJS repls :)