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

[Feature Request] Autostart/connect repl #1464

Closed Cyrik closed 1 year ago

Cyrik commented 2 years ago

When I open a Clojure project I usually start a repl immediately, so it would be nice if this could happen automatically. Of course, it should be an opt-in option.

This is even more helpful when developing calva itself since reconnecting on recompile feels strange as a Clojure dev. This would get us a step closer to something that feels like a hot-reload.

If this is something you want I could also write the PR for this.

bpringe commented 2 years ago

This is even more helpful when developing calva itself since reconnecting on recompile feels strange as a Clojure dev

Can you explain what you mean here by reconnecting on recompile?

bpringe commented 2 years ago

Let's see what @PEZ thinks about adding this.

Cyrik commented 2 years ago

Can you explain what you mean here by reconnecting on recompile?

I mean the basic flow of: change some code in calva, the watch recompiles, you hit restart on the debugger, the second IDE restarts the host and then you have to reconnect to the repl in it. I'd like to cut out the "reconnect to the repl" part. It's not a huge deal, but it does feel off when you are used to repl programming. A way to skip the port confirmation would probably already be enough, but auto-reconnect would be even closer to actual hot reloading.

PEZ commented 2 years ago

I don't think I have ever done this reconnect thing. I must test and see if I do it on auto-pilot and don't think about it.

As for the feature. Super early versions of Calva did this. Caused a lot of problems so I removed it. Could have made it an option, but it fell victim to my default answer to ”should I make it an option?” (no 😄). That said, I would merge a PR adding it as an opt-in thing.

Cyrik commented 2 years ago

I'm doing it the way the contributor how-to mentions. So there's a running repl in the vscode terminal and I call the "Calva Connect to a Running REPL" command but have to do this on every host restart. How do you handle this?

PEZ commented 2 years ago

shadow-cljs reconnects automatically when the host has restarted. It takes a few seconds. Maybe the same seconds it takes you to reconnect? 😄 If you have the debug console pane open when you restart the dev host you'll see a message from shadow when it is ready.

Cyrik commented 2 years ago

I was testing against the orchard repo, so a leinigen project without shadow. But how would shadow reconnect to Calva? I mean the repl in the vscode that's being debugged. I should have been more clear about that.

bpringe commented 2 years ago

I mean the repl in the vscode that's being debugged.

Ah yes, as far as I know, you do have to reconnect to the repl you're using in the development host each time you restart the development host.

PEZ commented 1 year ago

I missed to auto-close this with a commut, it seems.