Fork me on GitHub
#clojure-uk
<
2021-06-18
>
dharrigan06:06:59

Good Morning!

Jakob Durstberger08:06:47

Happy rainy Friday 🙂

dharrigan08:06:36

:umbrella_with_rain_drops:

dharrigan09:06:20

Does anyone use leiningen with rebel-readline and have a nrepl server running?

dharrigan09:06:21

it's a fancy terminal for interactive input that does things like tab completion, colourised output, highlighting, history,

dharrigan09:06:00

command history, multi-line editing, syntax colouring etc..

dharrigan09:06:10

I use it with deps, but not with leiningen

mccraigmccraig09:06:15

oh, nice - that sounds like i would use that - particularly multi-line editing

dharrigan09:06:01

Practicalli did a small video on it a while agao

mccraigmccraig09:06:22

i've often got a terminal repl running alongside a CIDER session, 'cos i don't find multiple concurrent CIDER sessions that great an experience

dharrigan09:06:12

I too have it running, but I'm working on a project that uses lein, so just seeing if anyone had it running. It does work, but it prevents nrepl from starting (not because of a bug or whatnot, but simply it doesn't understand how to)

dharrigan09:06:28

with clojure deps, it's dead simp

mccraigmccraig13:06:29

did you figure it out @dharrigan? i'm repling on a server atm, and it would actually be really handy to have multi-line editing

dharrigan13:06:32

I've decided to take the approach of maintaining my own deps.edn and migrating the project.clj to that 🙂 (keeping the existing lein configuration)

dharrigan13:06:13

So, you could said I abandoned the attempt to get it to work with lein, instead, I'm using my proven way of deps.edn

mccraigmccraig13:06:18

oh well 😢 . i'd like to switch to deps.edn, but it's going to be so painful

folcon15:06:00

@dharrigan I have all of that running on most of my projects, I don't believe it cases any conflicts...

folcon15:06:17

Is there an issue you're seeing 😃?

dharrigan15:06:55

I prerhaps didn't explain myself well...

dharrigan15:06:56

if you have this:

dharrigan15:06:04

❯ cat profiles.clj                                  
{:user {:dependencies [[com.bhauman/rebel-readline "0.1.4"]]
        :plugins [[cider/cider-nrepl "0.26.0"]]
        :aliases {"rebel" ["trampoline" "run" "-m" "rebel-readline.main"]}}}

dharrigan15:06:22

in your profiles.clj for lein, and you do this lein rebel, no nrepl server is started

dharrigan15:06:31

where as, if you simply do lein repl then it is

dharrigan15:06:28

I don't use lein that much (mostly been a deps guy from day one)

dharrigan15:06:41

so I don't know how it is possible to start up rebel and the nrepl server too

folcon16:06:43

Hmm, they coexist nicely in the same project. It's just normally I use rebel for the command line and nrepl for connecting to cursive. I do start up sessions with lein repl. Practicalli seems to be able to do it:

For a rich terminal REPL experience, start the REPL with rebel readline as well as nREPL and CIDER libraries.
clojure -M:repl/rebel-nrepl
From here:

dharrigan16:06:10

right, so that's a project.clj and a deps.edn being used

dharrigan16:06:33

I think it would be possible to do, for I do something similar with deps..

dharrigan16:06:04

As part of my "boot" of clj, I have this

dharrigan16:06:06

(defn start-nrepl
  [env-port]
  (let [server-map (nrepl/start-server
                    :port (or env-port 0)
                    :handler (apply nrepl.server/default-handler
                                    (-> (map #'cider.nrepl/resolve-or-fail cider.nrepl/cider-middleware)
                                        (conj #'refactor-nrepl.middleware/wrap-refactor))))
        port (:port server-map)
        port-file (io/file ".nrepl-port")]
    (.deleteOnExit port-file)
    (spit port-file port)
    (println (ansi/green (str "nREPL client can be connected to port " port)))))

dharrigan16:06:14

so I programmatically start the nrepl server

dharrigan16:06:25

I guess I can do the same in a user.clj on the lein project

dharrigan16:06:52

but <shrug>, might as well just convert the project.clj to deps.edn (which I've done as a POC) and it works grand