I fail to inject nrepl middleware from the command line #10
Labels
No Label
bug
contribution welcome
duplicate
enhancement
good first issue
help wanted
invalid
question
upstream
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: leiningen/leiningen#10
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
I am trying to inject shadow-cljs nrepl middleware from the command line. (I need this for Calva jack-in/connect). I'm sorry if this is not a particularly minimal repro, but I really don't know how to minimize it further. Mostly because I don't understand the issue enough.
I'm not even sure my expectations are valid.
Reproduction
My reproduction is using this tiny project and assumes node is installed: https://github.com/PEZ/shadow-w-backend
Steps:
:app
watcherNow what is expected is to get output like this:
Instead I get:
Notes
project.clj
project.clj
So my expectations here are that command line injections should be applied after the configuration is read from
project.clj
, and that it should be full equivalency if I configure both these middlewares either on the command line or inproject.clj
. Are these expectations reasonable?I guess this is difficult because there are a lot of moving parts, so let's try to break it down a bit. Middleware is one of the most unreliable things because of how many plugins try to activate it implicitly.
So maybe by identifying the individual steps we can break down the problem.
Does it look like the middleware is active before the repl command runs? If you replace the repl task with pprint (using the lein-pprint plugin) you may be able to debug to see if the problem is happening upstream of that task.
If this is a new issue in 2.9.9 or 2.9.10 it may be that the fix for #5 is responsible for this breaking, although I think that should only affect composite profiles, so it seems unlikely. But it would be helpful to know.
I'll try to debug a bit using those hints. Thanks!
That I have tried. I had a pretty old version on another machine of mine and it was the same there.
pprint
does seem to tell me something, even though I'm not savvy enough to interpret the message, so I'll paste the whole output to avoid deleting some clue:I notice:
[:repl-options :nrepl-middleware]
appears twiceIf I completely remove the
[:repl-options :nrepl-middleware]
injection, pprint still reports the last entry. Where the same cider.nrepl middlewares are included, but only once:I tested that Calva works without the
[:repl-options :nrepl-middleware]
injection, and it works just fine, so maybe the injection has never really worked?Yeah, looking more closely at it, this is just invoking the task incorrectly. In particular, this bit:
update-in '[:repl-options,:nrepl-middleware]'
is incorrect; it should just beupdate-in :repl-options:nrepl-middleware
instead.As per the docstring:
Let me know if you have any further questions.
Oh, wow. This has been like this in Calva since the start!
Iirc, I did what CIDER did. I'll have to ask Bozhidar if that could be so.
Thanks!
OK, so I am back at this and still can't quite figure it out. Trying with a simple, Clojure-only project. Starting the REPL like so:
Gives me:
There's clearly something I don't understand here...
I don't use cider so it's hard for me to say what's going on here, but
as far as I can tell this is working fine from Leiningen's
perspective. You can see that the right dependencies are present since
this command works normally:
I would guess that whatever you're running into must be an issue in nrepl or cider.
Thanks! I'll see if I can figure it out with that clue.