Fork me on GitHub
Zach Mitchell15:09:06

I was watching Sean Corfield's video about REPL driven development and I'm trying to achieve the same kind of workflow where the REPL is started outside the editor and is a long-living process. I grabbed his deps.edn and dev.clj that loads reveal , rebel-readline , and connects both to a socket REPL. What I'm struggling with at the moment is that I can't figure out how to get Calva to connect to this socket REPL. I select the "Calva: Connect to running REPL server in the project" command, and in the REPL pane it shows that it's trying to connect with nREPL. I'm new, so I think the issue is that my REPL that I've started is a plain socket REPL, whereas Calva is trying to connect to an nREPL server. Is that correct? Is there a way to connect to just a bare socket server, or should I focus on figuring out how to start the REPL as an nREPL server instead?


You are correct about Calva trying to connect to an nREPL server. There is no support for bare sockets. @U04V70XH6 is using Clover together with Calva, where Clover is providing the REPL connection. I suggest you figure out how to start an nREPL server. That is pretty easy. Calva has a command for copying the command it uses for starting the REPL. Search the command palette for ”copy jack-in” and you should find it. Then start your REPL using that command.


@U02CDRYNHDM My deps.edn used to have an :nrepl alias so you could start a basic nREPL server but I never integrated it with Rebel Readline or my :dev/repl alias because I haven't used nREPL for years (and in my last round of deps.edn changes, I removed the :nrepl alias because I never use it).

👍 2
Alexander Kouznetsov17:09:31

@U02CDRYNHDM Where can I see this video?


There are a few "short bites" videos of my workflow at and at some point I will make some more, but it's just not a medium I enjoy working with.


When using jack-in I don’t see it loading my .bash_profile in the terminal window it starts. It has commands I need to run before starting the REPL, so wondering how to fix that.


There is currently no way to run a command before the REPL is started. What does your command do?


It loads envars specific to the project I’m in, so without that I can’t really make use of the started REPL.


afaict new terminals I create in VS Code run the script correctly, but the jack-in REPL does not.


You have two options, I think: 1. Use the jackInEnv setting to provide the env vars that way. 2. Use the Copy Jack-in Command to Clipboard command to get the command that Calva would use to start the REPL. Then Connect to a running REPL.


Ok, yeah I'd need to use option two as the utility is it loads different envars based on the directory I'm on.


A particular project stays in the same directory, though, right? So if you use Workspace settings for setting jackInEnv it would more be similar. Even though it would also be duplicating the setup. Anyway, make a mental note about running that Jack-in Command to Clipboard command now and then to stay up-to-date with any requirements Calva might have about dependencies.