Fork me on GitHub
#cider
<
2021-02-11
>
waffletower06:02:24

I came up with a working PoC for injections using NREPL. Is there a more straight-forward way to accomplish this?

waffletower06:02:24

The injection in this case is requiring pprint.

waffletower06:02:42

The code is easily referenced in a deps.edn alias:

:inject {:extra-deps {waffletower/repl-eval {:local/root "../repl-eval/"}
                      nrepl/nrepl {:mvn/version "0.7.0"}
                      refactor-nrepl/refactor-nrepl {:mvn/version "2.5.0"}
                      cider/cider-nrepl {:mvn/version "0.25.1"}}
         :main-opts ["-m" "repl-eval.nrepl"]}
While I could refactor this to instrument variable middleware and injection forms, is there some hook I am missing here? It was much much easier and cleaner to accomplish REPL initialization with leiningen.

bozhidar12:02:41

I'm assuming by "injection" here you mean "evaluate some code on nREPL startup", right?

☝️ 1
bozhidar12:02:56

There's nothing in the existing CLI UI, although it'd be easy to add something like --init or whatever. CIDER itself injects a bit of code via cider-repl-require-repl-utils-code.

🙇 1
william12:02:58

Usually when I write a defn form in emacs, the docstring is rendered in a nicer style (italics, in my case). What should I modify if I want to get that when I use macros that replace the defn form, like >defn from guardrails?