Fork me on GitHub
#nrepl
<
2019-10-21
>
bozhidar05:10:57

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

bozhidar05:10:38

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

shen07:10:36

This is the rich printing functionality from unrepl?

pez08:10:33

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

dominicm08:10:57

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

pez08:10:00

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.

pez08:10:17

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

dominicm08:10:43

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

dominicm08:10:11

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

dominicm08:10:33

That's a much easier solution really.

bozhidar09:10:37

> This is the rich printing functionality from unrepl?

bozhidar09:10:09

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

shen09:10:22

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

cgrand09:10:30

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)

shen09:10:31

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

bozhidar09:10:28

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.

pez10:10:02

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

dominicm11:10:58

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

dominicm11:10:09

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

pez11:10:31

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

pez15:10:08

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?

bozhidar16:10:03

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

pez16:10:31

That sound pretty simple, yes.

pez16:10:11

Wow. that just worked.

pez16:10:30

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.

tmountain20:10:15

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

tmountain20:10:26

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

tmountain20:10:29

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

tmountain20:10:00

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

tmountain20:10:08

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?

pez20:10:35

Which version of cider-nrepl is being used?

tmountain20:10:13

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

dpsutton20:10:27

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

tmountain20:10:46

CIDER 0.22.0snapshot (package: 20190623.1003)

tmountain20:10:19

0.22.0-beta4 <- cider-nrepl version

dpsutton20:10:59

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?

tmountain20:10:37

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.

dpsutton20:10:27

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)

dpsutton20:10:35

haven't dug into the pprinting stuff too much

dpsutton20:10:46

but i've never regretted watching the nrepl traffic

pez20:10:38

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

pez20:10:52

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.

tmountain20:10:08

Gonna give that a try.

dpsutton20:10:28

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

tmountain20:10:58

Now it's working.

tmountain20:10:02

Thank you.

❤️ 4
dpsutton20:10:27

@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

dpsutton20:10:56

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

pez20:10:15

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

dpsutton20:10:37

touch .inline-deps that one

pez20:10:30

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…

pez21:10:31

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

dpsutton21:10:31

/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

pez21:10:51

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

dpsutton21:10:56

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

pez21:10:22

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