Fork me on GitHub
#tools-deps
<
2020-07-11
>
tolitius01:07:56

what is a tools.depsy way of starting (--interactive) REPL-y connected to nrepl?

:repl {:extra-deps {nrepl {:mvn/version "0.7.0"}
		              reply {:mvn/version "0.4.4"}}
         :main-opts ["-e" "(require,'[reply.main]),(defn,reply,[_,port,_],(reply.main/launch-nrepl,{:attach,(str,\"127.0.0.1:\",port)})),(ns,user)"
      	             "-m" "nrepl.cmdline" "-i" "-f" "user/reply"]}}
this works (ish), but feels complex + does not exit nrepl once REPL-y is done (ctrl c / ctrl d)

euccastro10:07:47

do you want to start your nREPL server with the same command?

euccastro10:07:55

I have this:

{:extra-deps {reply {:mvn/version "0.4.4"}}
   :main-opts ["-m" "reply.main" "--attach" "1337"]}

euccastro10:07:13

but that's to attach to an already running nREPL

tolitius14:07:26

right nrepl + REPL-y connected to it. I do most of the work in a vi + terminal REPL

tolitius14:07:55

*right => "start your nREPL server with the same command"

tolitius14:07:06

nrepl.cmdline optionally takes a repl-fn / -f for the interactive repling

seancorfield14:07:41

I think, for simplicity's sake, I'd be inclined to use two separate aliases: one to start an nREPL server (and leave it running in a window, or run it in the background), and a second alias to start REPL-y connected to that background process.

seancorfield14:07:04

I can understand wanting a single command, but I'd probably write a small shell script that just ran two clojure commands if it proved too annoying to run those two commands manually.

tolitius17:07:08

@seancorfield definitely a possibility, but if I work with several (different) apps that's a twofold repl things to run and exit from I am just looking for "lein repl" / "boot repl" repl-y like experience with deps.edn

seancorfield17:07:38

Hmm, I never type into a REPL so I only care what my editor integration does. Why do you need REPL-y, specifically @tolitius?

tolitius17:07:57

I always type into repl )

tolitius17:07:52

it's connected to vi where I "finalize" my thoughts after I am done thinking in repl

tolitius17:07:20

and vice versa compile/reload from vi back to repl tp keep thinking

seancorfield17:07:32

I "think" in a "Rich Comment Form" in my editor -- like Stu Halloway talks about in some of his presos

tolitius17:07:11

yea, a lot of Clojure devs use an integrated playground to "think" that is just connected to nrepl that runs in the background. I like terminals, terminal repl works best for me since I am focused on small fragments of code at a time. with REPL-y this experience is simple, so I am just looking to get there with deps.edn

tolitius17:07:55

which I did get with an above alias but it rather feels off + does not exit the nrepl on ctrl c/d

seancorfield17:07:05

I think you're stuck with the complex/almost-works invocation for now. I'll have a think about it on and off and come back if I figure out anything better.

tolitius17:07:40

yea, nothing urgent, I was just wondering whether I am missing something obvious, i.e. a flag, an option, etc..

seancorfield17:07:45

(I don't use nREPL at all so it'll be a fun experiment/diversion)

tolitius17:07:57

good luck and thank you )

richiardiandrea19:07:22

@tolitius Hey 😉 I am using https://github.com/bhauman/rebel-readline For your exact use case and I found some problems with multi-line expressions sometimes, I am pretty happy with it. I have two aliases I can share (the second is for cljs) not in front of the keyboard now though. Will sent them soon.