Subject: bug#62116: RFE: eglot: support window.showDocument LSP RPC

From: Alan Donovan <[email-masked]>
Date: Wed, 24 May 2023 18:13:25 -0400

Thanks for following through with this change. I just tried the
committed version and it works nicely for me.

On Tue, 16 May 2023 at 14:32, João Távora <[email-masked]> wrote:
>
> [ Cc'ing Dmitry mostly because of the question in the last paragraph ]
>
> On Mon, May 15, 2023 at 11:45 AM João Távora <[email-masked]> wrote:
>
> > I'm working on this change to jsonrpc.el.  This will solve the Eglot
> > showDocument
> > problem by allowing the find-file _and_ the return code calculation to be async.
>
> Continuing this soliloquy :-) I'm putting this more ambitious change
> on the back burner.  It's not immediately clear how to implement this
> cleanly.  The best I can think of is to change jsonrpc.el to allow the
> request handler to return a function  that is then passed a "success"
> and an "error" callbacks.  But not only is this not spectacularly clean,
> it  doesn't really solve the "nested" request problem by itself.
> Furthermore there aren't any other clients for these kinds of requests
> yet, and there seems to be ongoing work for a future/promises system
> which could make this cleaner.
>
> So for window/showDocument specifically, I went with the much simpler
> check of file-readable-p before reporting success (or failure).
>
> I also addressed Alan's report of a problem with the widening.  I
> used xref--goto-pos, which I normally wouldn't do, but that
> internal function semantics is exactly what was needed here.
> Maybe Dmitry can agree to export it?
>
> João