nrepl

jasalt 2025-03-14T11:32:39.616869Z

I note this legacy code defconst cider-info-form https://github.com/clojure-emacs/cider/blob/master/cider-client.el#L527 with comment: > FIXME: Now that nREPL supports a lookup op natively, we should remove this eval-based hack at some point. This fails with Phel server implementation of course so I disabled it in Cider client for now (setq cider-info-form "") . While this method is still used by default, guessing it just needs to be lived with for now (leads to some extra client side setup code). Ideas welcome if it could be done smoother (to have minimal client specific hacks).

jasalt 2025-03-17T14:40:45.571449Z

Added lookup and info ops and was able to take out the workaround (setq cider-info-form "")`` from Emacs config. Cider calls the defined info op correctly as far as I tested. Added issue about cleaning/fixing the old code https://github.com/clojure-emacs/cider/issues/3788

bozhidar 2025-03-17T15:15:52.801169Z

Just an FYI - you don't really need to implement both lookup and info. lookup is the official op from the protocol and info is something from cider-nrepl. We never got to namespacing the ops properly, so it's probably not obvious from CIDER's code which op is coming from where.

jasalt 2025-03-17T19:24:33.778429Z

A-ha, yea, that was bit hard to decipher. I started out just enabling both going with the same handler (response following cider / info docs), something off still and it was blocking the completions UI pretty bad but continuing later.

jasalt 2025-03-17T19:27:04.250929Z

It's bit unclear what the full lookup response format is (https://nrepl.org/nrepl/ops.html#lookup) only saying "Returns`:info` A map of the symbol’s info." Contrast to Cider info (https://docs.cider.mx/cider-nrepl/nrepl-api/ops.html#info). Not sure what to follow at the moment, or what example would do things the cleanest way currently.

bozhidar 2025-03-18T05:37:57.465739Z

The return format for both is pretty similar. Seems I had forgotten document lookup properly. Feel free to open a ticket for this as well.

👍 1
jasalt 2025-03-18T06:21:09.276129Z

I think this ticket from 2021 comes quite close, or does it point to something else (not sure what the middleware there stands for)? "Document better the lookup middleware return values" https://github.com/nrepl/nrepl/issues/257 "Document lookup operation return value" would probably be better naming if that ticket would be correct for the topic.

👍 1
bozhidar 2025-03-18T06:21:52.526809Z

Ah, seems I have forgotten about it.

bozhidar 2025-03-17T05:38:05.071759Z

Yeah, this can be removed. Originally I had kept it around until more of the users were on a version of nREPL that supported the latest version of the protocol. It’s strange that the op version doesn’t take precedence, though - like a bug on that front. Should be an easy fix. @j.s Can you file a ticket for this?

bozhidar 2025-03-17T05:45:02.069809Z

Btw, looking at the code this is called only if info and lookup are not supported https://github.com/clojure-emacs/cider/blob/master/cider-client.el#L562

jasalt 2025-03-17T06:03:51.338409Z

@bozhidar thank's for checking it out, I'll see how it behaves with info and lookup defined soon.

jasalt 2025-03-14T11:36:20.944639Z

Video for context. This function tries to fetch the completion specific info.