cider

oyakushev 2025-05-01T08:17:05.042759Z

Greetings, CIDER enjoyers! cider For the future 1.19 release, we consider removing the jack-in support for https://github.com/clojure-emacs/enrich-classpath (`cider-enrich-classpath` variable) in order to simplify the codebase. The recently added on-demand fetching of Java sources (https://docs.cider.mx/cider/usage/working_with_documentation.html#obtaining-source-jars variable) is a less invasive solution that hopefully addresses all of the same needs. For those who continue using enrich-classpath, could you please respond with and tell in the comments if anything prevents you from switching? if you never used enrich-classpath, ➡️ if you switched from enrich-classpath to cider-download-java-sources already. Thank you!

➡️ 3
➖ 13
➕ 1
vemv 2025-05-01T09:17:12.251669Z

as the author of Enrich, I can say that moving away seems the right course of action for the simple reason that it's no longer maintained. I'm happy that it helped solve a problem that was deemed too hard before. And if we have something leaner now, so much the better!

❤️ 2
Drew Verlee 2025-05-01T16:13:30.088369Z

Why is it better? is there a quick description of the difference?

Drew Verlee 2025-05-01T16:16:22.846989Z

thanks ill give it a read.

jmckitrick 2025-05-01T14:38:18.513619Z

I see last year 'cider-upgrade-nrepl-connection' was removed as not being useful to the community. Is there a better way to dynamically upgrade a connection today?

oyakushev 2025-05-01T16:12:06.330879Z

This was removed together with big nREPL refactor which also dropped the sideloading capabilities, unfortunately. I'd say that it wasn't deemed not useful, but rather the implementation was too complicated for the limited usability that it provided. But we may explore the possibility of bringing it back via simpler mechanisms in the future. Could you please tell what is your usecase for it? Do you start nrepl server without cider-nrepl and then want to sideload cider-nrepl middleware into it? Is there something that prevents you from including cider-nrepl at the server side?

jmckitrick 2025-05-01T16:13:57.466889Z

We had been including it in our project dependencies because half our team uses cider, but the other half does not. But after the bug last week that maxed out 100% CPU for the colleagues that did not use cider, it was decided that dependency had to be removed and we were left to figure out how to include it if we need it.

oyakushev 2025-05-01T16:17:00.081109Z

Damn, that's unfortunate. By the way, the 100% bug is fixed now (should be, at least). What do you use for your project, tools.deps?

jmckitrick 2025-05-01T16:19:59.791349Z

Yes, so we’re looking into user.clj to load it, but I have to stop the integrant wrapped nrepl service and restart it with cider nrepl loaded and enabled instead.

oyakushev 2025-05-01T16:20:32.626769Z

Wait, is it for a case for a remote REPL or is it run locally?

jmckitrick 2025-05-01T16:21:28.814759Z

Locally, but would still like to repl into prod sometimes. I can live with reduced functionality in remote prod

jmckitrick 2025-05-01T16:22:04.640099Z

Nrepl alone on prod might be enough

oyakushev 2025-05-01T16:22:14.123169Z

I mean, for local case you can include the cider stuff in a separate alias and conditionally enable it, right?

jmckitrick 2025-05-01T16:23:01.291489Z

Yes I’m working on that now. It’s just a nuisance lol

oyakushev 2025-05-01T16:23:38.315949Z

I guess, you would need to hack the nrepl starting code too. I assume, you don't use cider-jack-in, but the nrepl server is started manually from the code?

jmckitrick 2025-05-01T16:23:54.727049Z

Since nrepl will remain, side loading would have been nice but not essential

jmckitrick 2025-05-01T16:24:31.807329Z

Correct, I prefer to start it and then connect. My colleague uses jack in however

oyakushev 2025-05-01T16:26:16.730209Z

With jack-in it's all done automatically anyway. If you start and connect, then it's common to make a separate alias for it. It's pretty much a common approach and a better one than including cider-nrepl into project dependencies (unless you also want cider-nrepl in prod but that's another story, yeah).

jmckitrick 2025-05-01T16:27:01.811979Z

Well, then I’ll be learning a superior approach it seems.

👍 1
jmckitrick 2025-05-01T17:25:04.079989Z

I always started and then connect separately. Is there any advantage to starting it directly from emacs?

oyakushev 2025-05-01T17:39:37.859739Z

Benefits of starting separately: • You have the REPL process in a dedicated terminal, see that it is running, can kill on demand. • Restarting Emacs leaves your REPL env intact. You can restart Emacs and reconnect to the same REPL. Benefits of cider-jack-in: • Puts all the necessary dependencies and config for you, so you don't need to have in-project or system-wide configuration for it in profiles.clj or deps.edn files.

Drew Verlee 2025-05-01T16:12:16.286279Z

Puget - do you use it, or do you prefer something else?

oyakushev 2025-05-01T16:13:48.415059Z

I asked this question before and there weren't many Puget users based on the answers: https://clojurians.slack.com/archives/C0617A8PQ/p1740567500814809

Drew Verlee 2025-05-01T16:20:06.746829Z

Thanks. Yeah, a lot of options, for some reason i was using pudget and i think it's been removed from nrepl so i have to include it or change to something that is included. I guess i'm confused on how these things compare. Like which one did nprel keep? pudget (obviously not) fipp, zprint? I probably didn't even need puget, it looks like it just adds things that matter if you print to the repl, which i don't do, i just use it in emacs. That and "Canonical Representation" which i would need rarely...

Drew Verlee 2025-05-01T16:22:32.231249Z

pprint to use the built-in clojure.pprint/pprint (this is the default). That makes sense.

oyakushev 2025-05-01T16:29:09.518659Z

I agree that CIDER includes too many pretty-printers, the difference between them is quite minimal, and it mosly only matters for stuff that is printed into the REPL buffer. That's why we've started to remove some of them. Zprint was never included, Puget is gone now, and Fipp is going away next. All three are still supported but you need them in the dependencies explicitly. I'd say 95% people either don't need pretty-printing in the REPL buffer (there are better tools for exploring data in CIDER, like https://docs.cider.mx/cider/debugging/inspector.html), or regular clojure.pprint/pprint is enough for them.

daveliepmann 2025-05-01T16:51:52.261759Z

Will that affect formatting of output in *cider-result*?

dpsutton 2025-05-01T16:52:19.586749Z

i prefer fipp for basically this one reason (and its faster)

card=> (fipp.edn/pprint (into-array [1 2]))
#object["[Ljava.lang.Long;" "0x7e55e9fe" "[Ljava.lang.Long;@7e55e9fe"]
nil
card=> (clojure.pprint/pprint (into-array [1 2]))
[1, 2]
nil

💯 1
dpsutton 2025-05-01T16:52:36.461389Z

arrays printing as vectors can be misleading when you don’t want it. or enormous

oyakushev 2025-05-01T16:55:22.562869Z

> Will that affect formatting of output in *cider-result*? Yeah, right, that one too.

daveliepmann 2025-05-01T17:02:55.277969Z

Well that's a bummer

oyakushev 2025-05-01T17:03:25.887969Z

What particularly, @daveliepmann? The puget thing?

daveliepmann 2025-05-01T17:03:27.701999Z

I suspect most people who use that feature use it because of the pretty-printing

daveliepmann 2025-05-01T17:07:48.670029Z

I'm responding to "95% people either don't need pretty-printing in the REPL buffer (there are better tools for exploring data in CIDER, like inspector)". I don't want to use the inspector, I want pretty-printing in *cider-result*. I don't have a clear idea of how the *cider-result* buffer will change but if it's a small difference between puget/etc and pprint then I don't see a problem

daveliepmann 2025-05-01T17:08:36.935899Z

(Adding a config step only bothers me when I put on my beginner-advocacy hat)

oyakushev 2025-05-01T17:09:16.696079Z

This was me responding to @drewverlee who is rightfully confused about the abundance of pretty-printing options and which should he choose and if it matters. From that standpoint, this is indeed not worth the added mental resource.

👍 1
oyakushev 2025-05-01T17:12:11.449589Z

None of the existing pretty-printers are going away from CIDER. What changes is that in order to use one, you would need to put it onto the classpath explicitly. Or as an alternative: • Select the regular clojure.pprint/pprint • We actually added another pprinter recently (I know facepalm) https://github.com/clojure-emacs/orchard/blob/master/src/orchard/pp.clj. It is based on https://github.com/eerohele/pp. It will probably be added as another printing option in CIDER in the future, and it will also be used as a fallback default for when Fipp/Puget/Zprint is selected but can't be found on the classpath.

daveliepmann 2025-05-01T17:13:09.859789Z

Thank you for the explanation 🙏

❤️ 1
daveliepmann 2025-05-01T17:13:21.230549Z

I think I misunderstood

oyakushev 2025-05-01T17:14:27.007799Z

It is confusing alright

kommen 2025-05-01T23:14:04.799669Z

I’m looking into setting *print-namespace-maps* to false when using the pprint printer but I’m having questions 🧵

kommen 2025-05-05T05:46:20.441999Z

I’m just going with (cider-repl-init-code . ("(set! *print-namespace-maps* false)")) for now

kommen 2025-05-01T23:15:55.355289Z

so I have

(setq cider-print-fn 'pprint)
(setq cider-print-options '(("print-namespace-maps" nil)))

kommen 2025-05-01T23:17:54.856209Z

which doesn’t work because cider.nrepl.pprint/pprint doesn’t do the with-bindings which only cider.nrepl.pprintp/pr does: https://github.com/clojure-emacs/cider-nrepl/blob/6e0d8421bebc87d047dee16dccc04331af8e7e5a/src/cider/nrepl/pprint.clj#L50-L55

kommen 2025-05-01T23:20:35.328879Z

however, even if cider.nrepl.pprint/pprint would use (with-bindings (pr-bindings options) ,,,) the nil from the cider-print-options is encoded as [] as the options are parsed as {:print-namespace-maps []} so that also is not helpful…

kommen 2025-05-01T23:21:03.212889Z

I found https://github.com/clojure-emacs/cider-nrepl/issues/807

kommen 2025-05-01T23:22:33.325949Z

and this seems to be related to encoding nil : https://github.com/clojure-emacs/cider/issues/2362

kommen 2025-05-01T23:25:31.175549Z

so for now I go with a custom cider-print-fnwhich rebinds #'clojure.core/*print-namespace-maps* regardless of the options. but I’m wondering if I’m missing something?