nrepl

https://github.com/nrepl/nrepl || https://nrepl.org
bozhidar 2019-10-21T05:39:57.067100Z

@pez Right now this can’t be done, but we’ve discussed it at some point with @shen. As this would result in changing more than the data encoding we’ve decided to first just return exactly the same data and consider a “richer” format down the road.

bozhidar 2019-10-21T05:40:38.067700Z

How do you plan to handle raw EDN on the client, btw? You might end up having to deal with unknown data readers (for instance)?

shen 2019-10-21T07:55:36.068900Z

This is the rich printing functionality from unrepl?

pez 2019-10-21T08:22:33.074700Z

> How do you plan to handle raw EDN on the client, btw? You might end up having to deal with unknown data readers (for instance)? To avoid burning up my computer just because I have pprint enabled when I evaluate a datomic transaction, I am moving the pprint stuff client side in Calva. I then have the problem that I need to parse the result and those datomic value-symbols do not parse. I solve it by just printing it w/o prettifying in the catch clause. But if I could get the result that I today get as EDN, then maybe I can get a prettifyer to work on it. I haven't tested that yet, because I don't know how to test it. So wanted to check if I could even dream about having EDN in, before I go about figuring out the next step.

dominicm 2019-10-21T08:23:57.076700Z

Seems like you could write a new server-side pretty printer?

pez 2019-10-21T08:24:00.076900Z

As for unkown data readers. We already have that situation with the non-pretty results, right? They come back as literals. Only if I let nrepl pretty-print it they get unpacked.

pez 2019-10-21T08:25:17.077800Z

Yeah, I should test with providing a server side pretty printer too. I'll try to find the time.

dominicm 2019-10-21T08:32:43.078600Z

I'm assuming it's the same effort, and it means I can use it too

dominicm 2019-10-21T08:33:11.079500Z

Fwiw, we could also include default printers for annoying things in common libraries (eg datomic db)

dominicm 2019-10-21T08:33:33.079800Z

That's a much easier solution really.

bozhidar 2019-10-21T09:12:29.080Z

@dominicm I agree.

bozhidar 2019-10-21T09:13:37.080200Z

> This is the rich printing functionality from unrepl?

bozhidar 2019-10-21T09:14:09.080700Z

@shen Yeah. Although I think we had discussed this independently before as well.

shen 2019-10-21T09:43:18.084800Z

righto.

shen 2019-10-21T09:44:22.085900Z

guess this could also help if there were a server side printer? https://github.com/nrepl/nrepl/issues/93

cgrand 2019-10-21T09:46:30.087200Z

I’m a channel zombie but... what’s the status/current thinking on printing? Last I was alive and taked with @bozhidar I think we discussed: 1/ unbundling printing in: * generic preemptible walking (can only done server-side) * layout (client or server) 2/ using unlikely char sequences (unicode provate or ANSI escape code) to intersperse “browsing affordances” in the middle of printed output (for quick regex-powered rendering)

shen 2019-10-21T09:54:31.088700Z

Not sure there has been much more talk? think @bozhidar just talked to me about some of the ideas that's been floating around

bozhidar 2019-10-21T09:55:28.089600Z

Yeah, nothing much has happened. The convos we had with @cgrand in the printer PR are still as relevant as before and we still need to decide on the approach there.

pez 2019-10-21T10:51:02.091600Z

> I’m assuming it’s the same effort, and it means I can use it too Fair enough. Before I go about changing Calva to use EDN Transport and try solve it that way, I’ll look at doing it server side, where we already have EDN (I assume).

dominicm 2019-10-21T11:02:58.092100Z

In the server, you have values, classes, objects, etc

dominicm 2019-10-21T11:03:09.092500Z

It's way easier, because you have richer data.

pez 2019-10-21T11:13:31.092900Z

Though it is the data richness that is my current problem. 😃

pez 2019-10-21T15:56:08.094Z

From https://docs.cider.mx/cider-nrepl/hacking.html > If you’re already using a client that depends on cider-nrepl (e.g. CIDER) making changes to the cider-nrepl code will normally result in those changes becoming immediately available to your client. How do I set things up to reach this nirvana?

bozhidar 2019-10-21T16:05:03.095Z

I just start lein repl in the source folder of cider-nrepl and connect to it. Pretty simple.

pez 2019-10-21T16:37:31.095500Z

That sound pretty simple, yes.

pez 2019-10-21T16:40:11.095900Z

Wow. that just worked.

pez 2019-10-21T16:47:30.097700Z

Is there a way I can get the same magic with my test project? I mean, I have a test project with which I’d like to use my custom cider-nrepl.

tmountain 2019-10-21T20:18:15.099Z

Hi, I use Spacemacs/Cider for my Clojure development. Earlier today, cider results stopped pretty printing for me.

tmountain 2019-10-21T20:18:26.099400Z

If I eval the following in Spacemacs, it starts working again.

tmountain 2019-10-21T20:18:29.099600Z

(set! nrepl.middleware.print/*print-fn* clojure.pprint/pprint)

tmountain 2019-10-21T20:20:00.100500Z

But, I have to this every time a new nrepl session is initiated.

tmountain 2019-10-21T20:21:08.101300Z

Any ideas why this happened, and worst-case, is there a way to set the expression above in a global config to get back to the desired behavior?

pez 2019-10-21T20:23:35.101600Z

Which version of cider-nrepl is being used?

tmountain 2019-10-21T20:25:13.102Z

I'm not sure. It's using whatever Spacemacs installed. Is there a way to get the version?

dpsutton 2019-10-21T20:26:27.102400Z

it'll be in the messages buffer when you start a session. also, can you check m-x cider-version?

tmountain 2019-10-21T20:26:46.102600Z

CIDER 0.22.0snapshot (package: 20190623.1003)

tmountain 2019-10-21T20:27:19.103Z

0.22.0-beta4 <- cider-nrepl version

dpsutton 2019-10-21T20:27:59.103600Z

well nothing in your setup related to CIDER changed today i don't think. is this a new/different project? maybe there are some dir-locals in the other one if so?

tmountain 2019-10-21T20:29:37.105100Z

Yeah, it's super weird. Spacemacs crashed (loading a very large JSON payload from an API), and then after that, it's been refusing to pretty-print. I spun up a new project with lein to see if it was specific to my existing project, and the same issue persists.

dpsutton 2019-10-21T20:32:27.105800Z

you can m-x toggle-message-logging and watch for the values going over. (i think they are config that are sent over at startup)

dpsutton 2019-10-21T20:32:35.106100Z

haven't dug into the pprinting stuff too much

dpsutton 2019-10-21T20:32:46.106500Z

but i've never regretted watching the nrepl traffic

pez 2019-10-21T20:38:38.107700Z

It’s a pretty ancient CIDER though. Maybe take the opportunity to upgrade it?

pez 2019-10-21T20:39:52.108700Z

I’m pulling my hair trying to test my custom cider-nrepl in another project. make install should do it, right? Except, it doesn’t.

tmountain 2019-10-21T20:41:08.109100Z

Gonna give that a try.

dpsutton 2019-10-21T20:41:28.109500Z

what lein are you on @pez. some older leins had trouble with that

tmountain 2019-10-21T20:43:58.109800Z

Now it's working.

pez 2019-10-21T20:43:58.109900Z

2.9.1

tmountain 2019-10-21T20:44:02.110100Z

Thank you.

1❤️
dpsutton 2019-10-21T20:46:27.110800Z

@pez in the makefile there's some file that's created to indicate the inlining had been done. try deleting that and lein clean and then make install again

dpsutton 2019-10-21T20:46:56.111400Z

also, make sure that the version you are installing is the version you are using in your projects. if it installs 24-snapshot and the others are using 23 or something you'll not see it

pez 2019-10-21T20:49:15.112200Z

Yeah. I’ve tried bumping it to 27 and such just to force it to use my install. Will try the cleaning now.

dpsutton 2019-10-21T20:49:37.112400Z

touch .inline-deps that one

pez 2019-10-21T20:54:30.114Z

So I deleted the file .inline-deps, then lein clean and then make install. The inlining happened again. But my version is still not used. So strange…

pez 2019-10-21T21:04:31.114400Z

I start the repl like so:

lein update-in :dependencies conj '[nrepl"0.6.0"]' -- update-in :plugins conj '[cider/cider-nrepl"0.27.0-SNAPSHOT"]' -- update-in '[:repl-options :nrepl-middleware]' conj '["cider.nrepl/cider-middleware"]' -- repl :headless

dpsutton 2019-10-21T21:06:31.114600Z

/usr/local/bin/lein update-in :dependencies conj \[nrepl\ \"0.6.0\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.22.4-SNAPSHOT\"\] -- repl :headless :host localhost is what CIDER cranks up

pez 2019-10-21T21:09:51.115600Z

I’ll try with removing :repl-options and see if that is what causes the strangeness.

dpsutton 2019-10-21T21:10:56.116Z

not sure if the different style of quoting matters ¯\(ツ)

pez 2019-10-21T21:14:22.117300Z

That would make it not work at all, rather. Not just pull in some wahetevr cider-nrepl. Well, that’s what I think. Right now I am ready to believe anything. 😃