GNU bug report logs - #62116
RFE: eglot: support window.showDocument LSP RPC

Previous Next

Package: emacs;

Reported by: Alan Donovan <adonovan <at> google.com>

Date: Sat, 11 Mar 2023 04:11:03 UTC

Severity: wishlist

Tags: patch

Full log


View this message in rfc822 format

From: João Távora <joaotavora <at> gmail.com>
To: Alan Donovan <adonovan <at> google.com>
Cc: sebastian.poeplau <at> mailbox.org, Felician Nemeth <felician.nemeth <at> gmail.com>, 62116 <at> debbugs.gnu.org
Subject: bug#62116: RFE: eglot: support window.showDocument LSP RPC
Date: Fri, 12 May 2023 00:12:13 +0100
Alan Donovan <adonovan <at> google.com> writes:

> On Fri, 5 May 2023 at 13:17, João Távora <joaotavora <at> gmail.com> wrote:
>> Yes, but I don't really think this is a design problem with gopls.  Or
>> at least I don't think Eglot should not make these nested calls in the
>> first place.  So I would like to understand how this nested RPC requests
>> takes place.  From my reading of the eglot.el's code, there aren't any -- that
>> is, with Emacs -Q -- at least.
>>
>> So I would like to reproduce this situation to analyse what can be done.
>>
>> I have gopls on my archlinux machine, though I seldom program in Go.
>> How does one go about setting up gopls in terms of workspace
>> configuration, command line options, etc so that the feature is
>> exercised?  Also, can I somehow make use of this feature with any small
>> hello world project or do I need something bigger?  In that case can you
>> point me to a git repository that I can download, or attach that
>> project?
>
> Sure. You can reproduce the experimental setup like so:

Hi Alan,

I've now reproduced your setup more or less (though I had to C-u M-x
eglot and point it to ~/.golang/bin/gopls instead).

Instead of your original patch for window/showDocument, I used Feliciáns
simpler alternative, and as I predicted, I didn't run into any hangs.

When clicking links of the ephemeral web server spun by gopls, it
predictably sends a window/showMessage request to Eglot like for example
here.

  (:jsonrpc "2.0" :method "window/showDocument" :params
            (:uri "file:///home/capitaomorte/Source/Go/tools/go/analysis/validate.go" :takeFocus t :selection
                  (:start
                   (:line 21 :character 5)
                   :end
                   (:line 21 :character 5)))
            :id 15)

This causes Eglot to visit validate.go and shortly after a notification
is sent Eglot -> gopls

  (:jsonrpc "2.0" :method "textDocument/didOpen" :params
            (:textDocument

So there must be something more happening in your Emacs setup.  If some
kind of asynchronous behaviour is required, this recipe doesn't
demonstrate it.  I invite you to fine-tune your recipe and to start
Emacs the -Q flag so that we can rule out interference from other
packages or bits of configuration.

In the meantime, I think we should go ahead with Feliciáns patch.  We
can always adjust it later.

João

PS: I did find a bug in Eglot, I think when trying your experiment, but
it is unrelated to the matter at hand.




This bug report was last modified 1 year and 291 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.