Fork me on GitHub
#tools-deps
<
2018-12-11
>
borkdude10:12:35

Is there an overview of how people can get a REPL in their editor for a deps.edn based project (without adding nREPL-specific deps to the deps.edn, so by setting up an alias in their profile)?

orestis10:12:28

Ah, you’re looking for a proper guide, not just an alias?

orestis10:12:38

Here’s my cider-nrepl alias, FWIW:

:cider-nrepl {:extra-deps {nrepl/nrepl {:mvn/version "0.4.5"}
                             cider/cider-nrepl {:mvn/version "0.18.0"}}
                :main-opts ["-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]"]}

orestis10:12:27

I start my REPL by doing clojure -A:cider-nrepl and then connect CIDER to it via cider-connect. I think that any nREPL-aware editor could do the same?

borkdude11:12:35

yeah, maybe I could just add that to the README

richiardiandrea17:12:14

I do the same the ClojureScript one is very similar

borkdude17:12:37

cool, that’s the page I was looking for

borkdude17:12:52

I guess it has to be CIDER agnostic since some people use VSCode or whatnot

richiardiandrea17:12:32

Yep well cider is just a middleware. Also keep in mind that Calva for VSCode does use the cider Middleware

borkdude17:12:06

Honestly I don’t know how that all works, I just use it

borkdude10:12:51

I’d like to link to something like that in https://github.com/borkdude/advent-of-cljc

pesterhazy20:12:12

@borkdude The problem with using an alias that sets "-m" "nrepl.cmdline" is that it doesn't allow you to also specify -r or -m rebel-readline.main

pesterhazy20:12:26

To me an nREPL-connected editor is only one part - the other part is a terminal/rebel-readline based prompt

pesterhazy20:12:48

That could be solved if nrepl.cmdline supported a --next-main or --chain argument, like --chain rebl-readlin.main. What it would do is to spawn the server in the background and then call the next main function

pesterhazy20:12:36

It could even do clean-up when that chained main exits

pesterhazy20:12:17

@alexmiller has mentioned a start option, which could be in the same area

orestis20:12:22

+1 for that. I never got to try it but I think you can combine -e to evaluate something arbitrary with -m ?

pesterhazy20:12:51

yes you can -e something -e something-else -m some.main, though -m must be last

pesterhazy20:12:25

but those don't work if the settings are specified in different aliases - the latter alias will override the earlier one

viesti20:12:29

A colleague of mine ran into this: https://github.com/gfredericks/user.clj, maybe one could start nrepl server at load of user.clj?

pesterhazy20:12:29

yes, a library could be used for this purpose

borkdude21:12:18

@pesterhazy cool, if you have anything better to link to, I would update the README with it

dominicm21:12:17

In edge I have this working

dominicm21:12:54

It depends on a process in user.clj which searches for jvm options like load_xyz, which are then translated to namespaces to load. This means you can start arbitrary background services.