Fork me on GitHub
Drew Verlee00:04:02

What does this mean? > CIDER can also inject a Clojure dependency into your project From What does it mean for Cider to inject a clojure dep into my project? Like, the cider client sends the running process code to use via the repl socket?


I'm honestly not sure what you've tried. Are there simple steps that I could try to reproduce?


Cider uses clojure code to do its thing. To do this it needs its dependencies which it injects at Jack in or else you provide manually

Drew Verlee01:04:26

@dpsutton Well the problem is that i can’t get cider to connect to a repl that works e.g evals expressions, finds the deps specified in deps.edn via :local/root here is the project: 1) run clj -A:nrepl 2) from emacs run cider-connect I get no port to connect to. If i just run cider-jack-in i get a huge stack trace error that i’m not even sure how to copy paste because it appears in a window and this disappears 😞


Check in the messages buffer. Should be in there


I'm not sure how polished or even implemented deps edn support is to be honest though


Also don't know if you need to provide cider nrepl and orchard dep as well. I know we don't merge that profile into the deps so I imagine you need to provide ciders requirements

Drew Verlee01:04:39

what is orchard dep?


That's the guts of what cider does so that it can be decoupled from nrepl.


@drewverlee You can see exactly what’s the command line string that CIDER uses to start an nREPL server after invoking cider-jack-in. Nothing really special - it just adds a few deps, so you don’t have to add them to your projects.

Drew Verlee12:04:52

So it seems that cider-jack-in, as far as i can tell, calls this:

/usr/local/bin/clojure -Sdeps '{:deps {org.clojure/tools.nrepl {:mvn/version "0.2.13"} cider/cider-nrepl {:mvn/version "0.17.0-SNAPSHOT"}}}' -e '(require (quote cider-nrepl.main)) (cider-nrepl.main/init ["com.billpiel.sayid.nrepl-middleware/wrap-sayid", "refactor-nrepl.middleware/wrap-refactor", "cider.nrepl/cider-middleware"])'
which throws an exception … [let me find the actual exception]
rting nREPL server via /usr/local/bin/clojure -Sdeps '{:deps {org.clojure/tools.nrepl {:mvn/version "0.2.13"} cider/cider-nrepl {:mvn/version "0.17.0-SNAPSHOT"}}}' -e '(require (quote cider-nrepl.main)) (cider-nrepl.main/init ["refactor-nrepl.middleware/wrap-refactor", "cider.nrepl/cider-middleware"])'...
error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: Exception in thread "main" Could not locate refactor_nrepl/middleware__init.class or refactor_nrepl/middleware.clj on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.
I see where cider is invoking this function: But i’m not sure where all the deps come from, which would be useful because maybe i can adjust some of these deps. Sayid strikes me as a odd dep to include by default, so i assume thats coming from configuration i added but i can’t tell where.


I think there's a bug where dependencies aren't added, not sure what the status of that was though. I noted it a little while ago.

Drew Verlee12:04:49

does running clj -sDeps add to the existing deps files? Other wise i’m confused about how cider running that command would achieve the desired effect as it wouldn’t pick up the deps needed for the project. Clearly it does work, so i have a misconception somewhere.


Yes, it adds.


You certainly don’t need sayid or refactor-nrepl to be using CIDER. That’s certainly not coming from CIDER - likely you’ve got clj-refactor.el installed and its injecting those.

Drew Verlee13:04:07

@bozhidar Can you help me understand where i can look to see if its installed?

Drew Verlee13:04:32

Asking because i can’t seem to track down where this could come from: my spacemacs config file doesn’t mention it. I dont think its in my emacs folder and i’m not sure how to search emacs for it.


Those plugins are installed by spacemacs.


I just recently accepted a PR adding support for clj in refactor-nrepl


If memory serves right


Well Kinda related. @mbuczko contributed it


@benedek That’s different.


@drewverlee is having issues with the command generated by cider when refactor-nrepl is around. As I’m not familair with him setup I’m puzzled by what’s going on there - seems he’s getting some extra deps added and clj is blowing up.


Sayid is not done by clj-refactor tho


@drewverlee You can use package-list-packages to see what’s installed. If you’re using Spacemacs I guess you can take a look at its Clojure layer or whatever.


Probably it’s being added in Spacemacs…


Everything injects its own deps


No idea what they’ve put there.


So they should have sayid installed too


Look at the CLI, refactor-nrepl and sayid are not being injected as a dependency, only as middleware


Strange that refactor-nrepl is not availabe acc. To the error


I think the integration with the clojure tools is incomplete.


Seems so. Good catch


I mentioned this in a thread earlier, should have sent to channel also


So perhaps the clj integration is not using a var it should in CIDER?


that's correct. I flagged this up a while ago I think.


The problem is that the “real” integration relies on a lein-specific variable (namely plugins).


I’ve addressed @dominicm’s feedback actually (it was about the middleware stack), but as far as the deps go - it’s a bit of a mess.


I have to see what exactly is getting appended where.


i tried out the latest [cider/cider-nrepl "0.17.0-SNAPSHOT"] @bozhidar - when i cider-connect to a terminal app i'm now getting logging both on the terminal and in my cider-nrepl buffer. is it possible to stop the logging to the cider-nrepl buffer entirely, leaving only the terminal logging (i find logging to the emacs buffer mostly just obfuscates my repl session) ?


It’s tricky currently - that’s why I wanted to make this configurable, but didn’t have time for it.


@benedek I see the deps are dynamic, but I’ve hardcoded cider’s middleware as normally it comes from the odd lein plugin variable. Could it be that clj-refactor.el is actually updating it?


I think it adds to it


If that is what you asking


Yeah, that’s what I asking.


Just like sayid


And probably other plugins


OK, then I know how to fix this, but it seems to me we should change this to be have a separate notion of deps and lein plugins, as this is just confusing on boot, clj, etc.


sry i am confused now a bit


I thought we had separate things for those


We’ve got two vars - jack-in-deps and jack-in-plugins. Seems all extensions are adding their middleware deps to the plugins var, which is currently ignore by some of the code (I thought this was lein specific).


Probably as you flagged already the name could be improved


That’s where the problem is coming from.


I can fix this temporary by merging the plugins with the deps for clj, but I definitely think we should do something different and consider those plugins only for lein. Unfortunately this would mean we have to subtract the plugins from the deps for lein, but I guess that’s not a big deal.


lein:: Needs special plugin boot:: Explodes sequences and assumes they are all middleware clj/`cider.main`:: Same as boot


(Hoping to inspire you!)


Also - that isn't tested against sayid, which might be "weird"


I like the idea actually! That way we can stuff everything in the same list and just transform it accordingly for different tools.


My only maybe regret is that 'version' doesn't support tools.deps.alpha style dependencies, so git dependencies don't work. Hasn't been a problem so far, but I could see it eventually coming up.


@bozhidar pr ready for review again


On mobile now


@dominicm Everything looks good. The failures seem like some Travis issue, I’ll rerun the build.

Drew Verlee19:04:04

Just checking in on this, is there anything I can do help? Is there a ticket open somewhere where i can follow the changes? In case its not clear, i’m asking about the cider deps/clj integration. I get the impression everything isn’t wired up yet. Which is cool as i might be able to help. I assume this is a fairly request feature?


I’m gonna try to get to fixing my cider-nrepl changeset tonight. Sorry this has been so slow.


I really wanna rewrite the cider-repl.el to use separate markers for every REPL session. Right now all output gets interleaved in the most current eval result’s space.


But maybe that doesn’t make sense.


@drewverlee Just committed a fix for this.


@arrdem But how can we separate this? The output goes to whatever has been determined to be the current connection/repl.


@bozhidar it may not make sense - I think about CIDER as a code execution server, not a straight REPL. It’d be interesting to track nREPL request / response IDs and try to maintain a mapping from nREPL requests to “windows” in the buffer where results (output, print, etc.) go.


Rather than just maintaining one “end of buffer” to insert to which is what happens now.


The main effect would be that printing from threads would go to “old” eval “windows” not the current one


which may or may not be desirable depending on how you think about it.


I see. Well, that makes sense and it should be hard to implement. I don’t what else it’d affect apart from output from evaluations that happened before the “effective” connection got changed.


Should or shouldn't?