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


Message #37 received at 62116 <at> debbugs.gnu.org (full text, mbox):

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: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
Date: Fri, 05 May 2023 18:19:23 +0100
Alan Donovan <adonovan <at> google.com> writes:

> Hi Joao, sorry for the long radio silence. I've been meaning to return
> to this but we're in a release crunch lately.

Thanks for replying back.

> The reason for the async approach is to avoid nested RPCs between the
> client and gopls (Go LSP) server. The server is effectively
> single-threaded (the underlying JSON RPC implementation is full duplex
> but gopls' handlers use a lock), so if a server RPC initiates a
> showDocument downcall, which causes the client to open a file, then
> the find-file hooks for that file will make another RPC to the server,
> which causes it to get stuck. Arguably this is a problem in the design
> of gopls, but I doubt it is easy to fix, and I wonder how many other
> LSP servers have ended up taking the same approach. An alternative
> solution would be for gopls never to make a synchronous showDocument
> downcall, but instead to fire it off in another thread.

Yes, but I don't really think this is a design problem with gopls.  Or
at least I don't hink 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?

>> 1. if you think the Emacs frame should be raised and/or focused when a window.showDocument comes in.
>
> I think this is appropriate, since there's otherwise a good chance
> that nothing would appear to happen in response to (e.g.) a click. But
> perhaps we can play with it and get some experience. It may warrant a
> configuration option, but let's try to avoid that if possible.

Agree 100%.

My main curiosity is where does this "click" happen in the first
place...  (that's related to my lack of hands-on experience with this
feature, as described above)

>> 2. if browse-url should be used for non-file: urls (it might open a browser window outside of Emacs, which IMO is fine.)
>
> What's the alternative? The very purpose of the operation is to open a
> URL in a browser.

Not always, IIUC.  Sometimes it's just to open a file.  Also Emacs has a
web browser built-in.  We could theoretically force it to use this web
browser (though I don't think we should).

João





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.