Fork me on GitHub
#nrepl
<
2024-01-11
>
ericdallo19:01:27

Hey folks, I have a question about load-file op 🧵

ericdallo19:01:31

I implemented support for that on https://github.com/afucher/clojure-repl-intellij plugin, but it doesn't seem to work the same as cider for emacs, and may not be related with load-file itself I suppose, the problem is that if I start the repl with

clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version "1.0.0"} cider/cider-nrepl {:mvn/version "0.30.0"} refactor-nrepl/refactor-nrepl {:mvn/version "3.6.0"}} :aliases {:cider/nrepl {:main-opts ["-m" "nrepl.cmdline" "--middleware" "[refactor-nrepl.middleware/wrap-refactor,cider.nrepl/cider-middleware]"]}}}' -M:cider/nrepl
and try to eval a namespace via load-file, it doesn't eval the required namespaces first, I tried to understand if I should do something before checking the docs but couldn't find it.

ericdallo19:01:17

cider does something before start the repl, because it takes way more time to repl be ready, like it's loading the whole classpath or something, while starting the repl and calling the op load-file is quite fast but doesn't load the deps it seems

ericdallo19:01:12

I took a look on how cider does things, and it seems to just call load-file op as I'm doing, so I guess I'm missing something before, like when repl is starting

ericdallo19:01:31

c/c @U051BLM8F (you probably know something about that 😛)

dpsutton19:01:58

> and try to eval a namespace via load-file, it doesn’t eval the required namespaces first, can you be a bit concrete about this?

dpsutton19:01:30

and the failure?

ericdallo19:01:52

ah yeah, one sec

ericdallo19:01:39

It turns out I was starting the repl in a project and evaluating from another one facepalm, even so it seems to be having some issues with external project ns, and I managed to repro with cider if I start the repl in terminal and connect from emacs, but only in a Nubank repo, will try to repro in a public sample one so I can share more details

ericdallo19:01:10

anyway, thanks @U11BV7MTK! I let you know here if I find anything else

dpsutton19:01:08

was interesting to see the hacks that nrepl goes through for the otherwise simple “load code”

ericdallo19:01:00

yeah, I never tried any integration with nrepl before coding this plugin, it's been really fun and the docs are pretty straightforward :)

bozhidar19:01:46

Glad to hear this! And that the problem was sorted out by the time I read about it. 😄

😅 2