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).
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
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.
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.
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.
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.
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.
Ah, seems I have forgotten about it.
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?
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
@bozhidar thank's for checking it out, I'll see how it behaves with info and lookup defined soon.
Video for context. This function tries to fetch the completion specific info.