Fork me on GitHub
#cider
<
2018-04-16
>
drewverlee00:04:02

What does this mean? > CIDER can also inject a Clojure dependency into your project From https://cider.readthedocs.io/en/latest/installation/#ciders-nrepl-middleware 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?

dpsutton00:04:14

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

dpsutton00:04:25

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

drewverlee01: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: https://github.com/drewverlee/try-boot 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 😞

dpsutton01:04:59

Check in the messages buffer. Should be in there

dpsutton01:04:24

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

dpsutton01:04:31

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

drewverlee01:04:39

what is orchard dep?

dpsutton01:04:43

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

bozhidar05:04:14

@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.

drewverlee12: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" java.io.FileNotFoundException: 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: https://github.com/clojure-emacs/cider/blob/18a5f10021a70134310f367547c4c750e1acedba/cider.el#L529 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.

dominicm12:04:32

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.

drewverlee12: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.

dominicm12:04:35

Yes, it adds.

bozhidar13:04:45

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.

drewverlee13:04:07

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

drewverlee13: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.

dominicm13:04:50

Those plugins are installed by spacemacs.

benedek13:04:37

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

benedek13:04:53

If memory serves right

benedek13:04:01

Well Kinda related. @mbuczko contributed it

bozhidar13:04:20

@benedek That’s different.

bozhidar13:04:18

@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.

benedek13:04:56

Sayid is not done by clj-refactor tho

bozhidar13:04:00

@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.

bozhidar13:04:10

Probably it’s being added in Spacemacs…

benedek13:04:14

Everything injects its own deps

bozhidar13:04:16

No idea what they’ve put there.

benedek13:04:45

So they should have sayid installed too

dominicm13:04:21

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

benedek13:04:24

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

benedek13:04:42

Ah ofc @dominicm

dominicm13:04:47

I think the integration with the clojure tools is incomplete.

benedek13:04:07

Seems so. Good catch

dominicm13:04:27

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

benedek13:04:38

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

dominicm14:04:43

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

bozhidar14:04:48

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

bozhidar14:04:39

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.

bozhidar14:04:53

I have to see what exactly is getting appended where.

mccraigmccraig14:04:50

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) ?

bozhidar14:04:47

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

bozhidar14:04:19

@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?

benedek14:04:54

I think it adds to it

benedek14:04:03

If that is what you asking

bozhidar14:04:18

Yeah, that’s what I asking.

benedek14:04:37

Just like sayid

benedek14:04:58

And probably other plugins

bozhidar14:04:09

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.

benedek14:04:39

sry i am confused now a bit

benedek14:04:58

I thought we had separate things for those

bozhidar14:04:40

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).

benedek14:04:03

Probably as you flagged already the name could be improved

bozhidar14:04:13

That’s where the problem is coming from.

bozhidar14:04:40

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.

dominicm15:04:28

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

dominicm15:04:56

(Hoping to inspire you!)

dominicm16:04:25

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

bozhidar16:04:24

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

dominicm17:04:57

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.

dominicm17:04:29

@bozhidar pr ready for review again

dominicm17:04:35

On mobile now

bozhidar19:04:20

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

drewverlee19: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?

arrdem20:04:48

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

arrdem20:04:35

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.

arrdem20:04:46

But maybe that doesn’t make sense.

bozhidar20:04:59

@drewverlee Just committed a fix for this.

bozhidar20:04:24

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

arrdem20:04:52

@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.

arrdem20:04:05

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

arrdem20:04:09

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

arrdem20:04:18

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

bozhidar20:04:58

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.

dominicm20:04:45

Should or shouldn't?