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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Alan Donovan <adonovan@HIDDEN>; Keywords: patch; dated Sat, 11 Mar 2023 04:11:03 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 25 May 2023 01:03:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 24 21:03:45 2023
Received: from localhost ([127.0.0.1]:45488 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q1zOH-0002TI-SJ
	for submit <at> debbugs.gnu.org; Wed, 24 May 2023 21:03:45 -0400
Received: from forward501c.mail.yandex.net ([178.154.239.209]:54086)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dgutov@HIDDEN>) id 1q1zOC-0002T3-GN
 for 62116 <at> debbugs.gnu.org; Wed, 24 May 2023 21:03:40 -0400
Received: from mail-nwsmtp-smtp-production-main-38.myt.yp-c.yandex.net
 (mail-nwsmtp-smtp-production-main-38.myt.yp-c.yandex.net
 [IPv6:2a02:6b8:c12:228e:0:640:7578:0])
 by forward501c.mail.yandex.net (Yandex) with ESMTP id D92A15F150;
 Thu, 25 May 2023 04:03:33 +0300 (MSK)
Received: by mail-nwsmtp-smtp-production-main-38.myt.yp-c.yandex.net
 (smtp/Yandex) with ESMTPSA id V35sTYYDZ0U0-EX7XjTI3; 
 Thu, 25 May 2023 04:03:33 +0300
X-Yandex-Fwd: 1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail;
 t=1684976613; bh=1oMVmW4/HzfsKguUGNTeGkeaWdFsm30/NBJjrq5cqwg=;
 h=In-Reply-To:From:Subject:Message-ID:Cc:References:Date:To;
 b=qh5yV3d7LRjtAyF6lTrIlNwKhwCgKlVSCTg5PPjmwiqUJZqKcF8VAwOdIdKZGvVC+
 cOgc2zOrKCJUT+/n6Fg7Fth0UalT3CkEbPhQnRpVBD9eWBOUoUjxkgL7s5Gzze72D1
 +1sIlQHMTdPZIVY1Ke7nPxSgIPLYZJUqbyK2DmLM=
Authentication-Results: mail-nwsmtp-smtp-production-main-38.myt.yp-c.yandex.net;
 dkim=pass header.i=@yandex.ru
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailauth.nyi.internal (Postfix) with ESMTP id BF9D927C0054;
 Wed, 24 May 2023 21:03:30 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute1.internal (MEProxy); Wed, 24 May 2023 21:03:30 -0400
X-ME-Sender: <xms:4rNuZKkTdsaH9ZChSpuHYl_iApo1CZmhGPh3e8GKDYYkWGcGbhP7dA>
 <xme:4rNuZB1RsosBi8lKXv5TMmaPE0rFVvwJY3Bl1ZLgGNQh5_OrDil8eS_VRpJFrmihA
 flFlDHL2jq1OourWxs>
X-ME-Received: <xmr:4rNuZIrv6JM4C7q2g0s94k3tcrL9Tr5mYJ7EKLrO83mdElRXOFvnioMz5ANz9rY>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeejiedggeduucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegughhuthhovheshigrnhguvgigrdhruheqnecuggftrfgrth
 htvghrnhepgfejhfduffegvdevtefhgfettefgfeelgfelffehgeehhfeiudehfedvffeg
 teegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hguhhtohhvodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqddufeeffeelleeh
 hedvqddvleegjeejjeejiedqughguhhtohhvpeephigrnhguvgigrdhruhesfhgrshhtmh
 grihhlrdgtohhm
X-ME-Proxy: <xmx:4rNuZOllfwUlP2rFd3xzg2Fh1QjLo7fSfJA1tMgCWmlvS4xHRC8v4Q>
 <xmx:4rNuZI1-3Qmwc1EPP-FATZxwlOtX6LMnsdeq3jB2bHHyT-4me8R3PQ>
 <xmx:4rNuZFss5KP6M67Grainn26NYMXqlUxJ4PZmJkghBo6YknwyEusS9g>
 <xmx:4rNuZFyixaumDlytAcOdKjZjL8dzAEpkoSeYySu0WVfbDh3Mq0ngig>
Feedback-ID: ib1d9465d:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed,
 24 May 2023 21:03:29 -0400 (EDT)
Message-ID: <5c373eae-188f-d92d-9688-bd767de1348d@HIDDEN>
Date: Thu, 25 May 2023 04:03:26 +0300
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.11.0
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
Content-Language: en-US
To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>,
 Felician Nemeth <felician.nemeth@HIDDEN>
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN>
 <87v8j7vy48.fsf@HIDDEN> <83r0tuv62t.fsf@HIDDEN>
 <874jp8gu8a.fsf@HIDDEN> <838re3jowg.fsf@HIDDEN>
 <87ttwqsow9.fsf@HIDDEN> <87ttwpbpaj.fsf@HIDDEN>
 <875y93arek.fsf@HIDDEN>
 <CALDnm52V_B7p_Eg-VgzOcTpy206fEb1Z96xs4+5=aT3R3UBsmg@HIDDEN>
 <87h6sla14k.fsf@HIDDEN> <871qjm5pzk.fsf@HIDDEN>
 <877ctc8rc9.fsf@HIDDEN> <87wn1c4f65.fsf@HIDDEN>
 <87353y91p1.fsf@HIDDEN>
 <CALDnm52U-pKnc4hYhS5_TTPam4WyR45q8xnKUQtj8Lx-=NT=8A@HIDDEN>
 <CALDnm52RWX0av_L688Yk_cGNmD2AssgJ-nB11GaCKmEY1viWGQ@HIDDEN>
 <CALDnm50uDqMg8NgLYJThnxuu1CWDAv3omDLmBVE2RxdMgJ6hwg@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
In-Reply-To: <CALDnm50uDqMg8NgLYJThnxuu1CWDAv3omDLmBVE2RxdMgJ6hwg@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: -1.1 (-)
X-Debbugs-Envelope-To: 62116
Cc: 62116 <at> debbugs.gnu.org, adonovan@HIDDEN, sebastian.poeplau@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)

On 16/05/2023 21:34, João Távora wrote:
> 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?

I'm not sure it's a good idea to export it with that name: there is 
nothing xref-specific there. So you probably want a core function like that.

Or you can just copy the definition, it's quite small. There is no hurry 
either way.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 24 May 2023 22:13:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 24 18:13:46 2023
Received: from localhost ([127.0.0.1]:45394 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q1wjq-00035r-01
	for submit <at> debbugs.gnu.org; Wed, 24 May 2023 18:13:46 -0400
Received: from mail-pl1-f177.google.com ([209.85.214.177]:37237)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <adonovan@HIDDEN>) id 1q1wjn-00035a-Ga
 for 62116 <at> debbugs.gnu.org; Wed, 24 May 2023 18:13:45 -0400
Received: by mail-pl1-f177.google.com with SMTP id
 d9443c01a7336-1ae3f74c98bso25055ad.1
 for <62116 <at> debbugs.gnu.org>; Wed, 24 May 2023 15:13:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=google.com; s=20221208; t=1684966417; x=1687558417;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=eW0SY6faYQuYdYnNsY9oLK7e/sqtgy9g6pP6iZissYU=;
 b=a6IB89wuYJ8OvSZKpMTGMPczUk0WkrOiDG6Q3Qwt3ygq5+7MREguw3OyhNyS+elz1z
 FuwJALBgWJSj59EOrS5/0kXoixsU2Ko39Rzato/7HNqKISfRz3bMK2HfeVXQ4W0o8lSQ
 4xhYW/DqbJoWSR7xPOYflIGiuZTJa5f8NC1wBsNcV2y2vX7ET1csxNZ5Mvt2ePIdkIwT
 1VDungEDeNEXwX+VDIBpYJwHdxT/kdcoFXoNUUVQvOVoYLJNcGakSKH2aie19ThVCJo0
 MVTKWtdD4deU7Usms+u6jCugHCdFtPRnGjNda2oXg0YOUpDGnqeBU/0j0qEwCosauu6h
 V+MA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1684966417; x=1687558417;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=eW0SY6faYQuYdYnNsY9oLK7e/sqtgy9g6pP6iZissYU=;
 b=Wnabqqv8JwT0S0bJJHk4L05XP6h3NTNmjay5aA2wvG27kBTkctOCHPtl/TEZu1ECPN
 CBV6WT/Rbra5fz7WT6U1KdDdQLj79TIJEa1cUXT/BjNRgG9gWLOHnCL5tkvPxG5b+8BK
 3PX3PvX0ViolQgULGpYbMTIVUqmgvuM7w4zXKhcRHDc57auHZw5g4FfbGrXc88pAvLWN
 6+wP9J+IJ/whSAmPdIm/H1Uyrw0pjfIb5NWwGotIXlPj8GaB12Ct1beCv+QKNJ84CKqD
 oZP9JmPcVJgfT2ACc3vWauyDRVALRmQn2BGF8FPHnJtk1ohuEgRdvVZT5BbTqALaU4lc
 u7Gg==
X-Gm-Message-State: AC+VfDxGPErJ276iixYyahSyqL3T/vtrt3d+yEYiDcHPTgE7da7BLQ6C
 OTrSAVyf6yVkeRShtje1eN652Ao4nhpUntqIXMaYDg==
X-Google-Smtp-Source: ACHHUZ7AEl/aCO8ZS1vSnPnfDUXlpRXSCqhtSDOqQ7/DqlsSeLdMxNAbVyQXpJ14Cvj7UYGspIzc45zgbzLkPXnETvA=
X-Received: by 2002:a17:903:1cf:b0:19c:c5d4:afd2 with SMTP id
 e15-20020a17090301cf00b0019cc5d4afd2mr11738plh.11.1684966417389; Wed, 24 May
 2023 15:13:37 -0700 (PDT)
MIME-Version: 1.0
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN> <87v8j7vy48.fsf@HIDDEN>
 <83r0tuv62t.fsf@HIDDEN> <874jp8gu8a.fsf@HIDDEN>
 <838re3jowg.fsf@HIDDEN> <87ttwqsow9.fsf@HIDDEN>
 <87ttwpbpaj.fsf@HIDDEN>
 <875y93arek.fsf@HIDDEN>
 <CALDnm52V_B7p_Eg-VgzOcTpy206fEb1Z96xs4+5=aT3R3UBsmg@HIDDEN>
 <87h6sla14k.fsf@HIDDEN> <871qjm5pzk.fsf@HIDDEN>
 <877ctc8rc9.fsf@HIDDEN> <87wn1c4f65.fsf@HIDDEN>
 <87353y91p1.fsf@HIDDEN>
 <CALDnm52U-pKnc4hYhS5_TTPam4WyR45q8xnKUQtj8Lx-=NT=8A@HIDDEN>
 <CALDnm52RWX0av_L688Yk_cGNmD2AssgJ-nB11GaCKmEY1viWGQ@HIDDEN>
 <CALDnm50uDqMg8NgLYJThnxuu1CWDAv3omDLmBVE2RxdMgJ6hwg@HIDDEN>
In-Reply-To: <CALDnm50uDqMg8NgLYJThnxuu1CWDAv3omDLmBVE2RxdMgJ6hwg@HIDDEN>
From: Alan Donovan <adonovan@HIDDEN>
Date: Wed, 24 May 2023 18:13:25 -0400
Message-ID: <CAPVWWDV0JmLWF4=Vzs6JHSts7hsP47TnYcxonaZhOeV+nxmf4Q@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -8.0 (--------)
X-Debbugs-Envelope-To: 62116
Cc: sebastian.poeplau@HIDDEN, 62116 <at> debbugs.gnu.org,
 Felician Nemeth <felician.nemeth@HIDDEN>, Dmitry Gutov <dgutov@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -9.0 (---------)

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=C3=A3o T=C3=A1vora <joaotavora@HIDDEN> =
wrote:
>
> [ Cc'ing Dmitry mostly because of the question in the last paragraph ]
>
> On Mon, May 15, 2023 at 11:45=E2=80=AFAM Jo=C3=A3o T=C3=A1vora <joaotavor=
a@HIDDEN> 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=C3=A3o




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 16 May 2023 18:32:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 16 14:32:26 2023
Received: from localhost ([127.0.0.1]:48046 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pyzTG-0004KD-0K
	for submit <at> debbugs.gnu.org; Tue, 16 May 2023 14:32:26 -0400
Received: from mail-oo1-f53.google.com ([209.85.161.53]:55762)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@HIDDEN>) id 1pyzT7-0004Jp-5D
 for 62116 <at> debbugs.gnu.org; Tue, 16 May 2023 14:32:24 -0400
Received: by mail-oo1-f53.google.com with SMTP id
 006d021491bc7-54f846d24d1so3138787eaf.3
 for <62116 <at> debbugs.gnu.org>; Tue, 16 May 2023 11:32:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1684261931; x=1686853931;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=VvGHNH4cos/i50kPPWZvKaXFiY6NlRg+rjuRoiyqZGo=;
 b=EfzFKA89joMnl3nCzGZiXrY/A574PYV46ovPP5Lr6PIhqJwS4cGI2m6HaG3VVQx76f
 R6JK52H4zeqGacNo0CwjX1YZsBa7ODm0ObmyeijETM+7GSDJHpYyZBVNIx2KVm8W8yCp
 wjvhWgVE/CEmXqSkTvqvO6Sm30Z8Hl4pBgSlMY6XhnH2v4omhjdJehAJNlfjtWDXGtx2
 /Okz32VK9qedpvb5n4WrdC/4XpcJQwO3PJipDClDthnDJJnDSCfDvrApBCIEG7N0OHC1
 gSqTQNVJPdNPhl8eY1VrFfQCCHkVnAKsCJwqZDCQOOLcFaKWa+Ic/mH1xMIJI9n8oFxa
 5eJA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1684261931; x=1686853931;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=VvGHNH4cos/i50kPPWZvKaXFiY6NlRg+rjuRoiyqZGo=;
 b=TFPNklYKEKW2t8kFxinIV4V47wXS8WBD29Df5cDA9fWc1cM7i4NDedi3LPSyhBu+7Y
 rhG7wBlNRYwsmnjbm5YMq1LSia/bZtRgyHZtID5bJ3DAdzRpzPi1VqY2GJbstSbixjLc
 Dp2S7DPNj6JmQ83Q/R/1j9fgR05JUh55OZIJKvCfywCrvCAKliGgtMAIgTBF1j6jGSfs
 gNYnM3mXTbTikYlAjomiUanr40oh6NFqedxLdU945WtU2GnUMfFU/lo+6n9alWBRD57E
 9fSsASkNTfU9XF6QIGNUv9yQ0aVu4kqjYw4j9AKpGYrTc/MdghuOUXV+4+HbGqtKzXyR
 6Vow==
X-Gm-Message-State: AC+VfDx53A5JZitXkd260d35oDP2tgg4xCWk/G2ijErXctHwT9pkanbN
 LXc9Op5fhPB8tmliewlNXl8T4ZfWyE84bxxlswc=
X-Google-Smtp-Source: ACHHUZ7JkNhshpL0mytlW7saezvq4XXlaZZ0DwYBj+rp70gY+FdXSYqugMt5LiU+bb9xx5KIPwDvf5An8T0U/h06TIQ=
X-Received: by 2002:a05:6808:14d6:b0:396:63a:a704 with SMTP id
 f22-20020a05680814d600b00396063aa704mr4686846oiw.56.1684261931230; Tue, 16
 May 2023 11:32:11 -0700 (PDT)
MIME-Version: 1.0
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN> <87v8j7vy48.fsf@HIDDEN>
 <83r0tuv62t.fsf@HIDDEN> <874jp8gu8a.fsf@HIDDEN>
 <838re3jowg.fsf@HIDDEN> <87ttwqsow9.fsf@HIDDEN>
 <87ttwpbpaj.fsf@HIDDEN>
 <875y93arek.fsf@HIDDEN>
 <CALDnm52V_B7p_Eg-VgzOcTpy206fEb1Z96xs4+5=aT3R3UBsmg@HIDDEN>
 <87h6sla14k.fsf@HIDDEN> <871qjm5pzk.fsf@HIDDEN>
 <877ctc8rc9.fsf@HIDDEN> <87wn1c4f65.fsf@HIDDEN>
 <87353y91p1.fsf@HIDDEN>
 <CALDnm52U-pKnc4hYhS5_TTPam4WyR45q8xnKUQtj8Lx-=NT=8A@HIDDEN>
 <CALDnm52RWX0av_L688Yk_cGNmD2AssgJ-nB11GaCKmEY1viWGQ@HIDDEN>
In-Reply-To: <CALDnm52RWX0av_L688Yk_cGNmD2AssgJ-nB11GaCKmEY1viWGQ@HIDDEN>
From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Date: Tue, 16 May 2023 19:34:18 +0100
Message-ID: <CALDnm50uDqMg8NgLYJThnxuu1CWDAv3omDLmBVE2RxdMgJ6hwg@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
To: Felician Nemeth <felician.nemeth@HIDDEN>,
 Dmitry Gutov <dgutov@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62116
Cc: sebastian.poeplau@HIDDEN, adonovan@HIDDEN, 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

[ Cc'ing Dmitry mostly because of the question in the last paragraph ]

On Mon, May 15, 2023 at 11:45=E2=80=AFAM Jo=C3=A3o T=C3=A1vora <joaotavora@=
gmail.com> 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=C3=A3o




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 15 May 2023 10:43:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 15 06:43:37 2023
Received: from localhost ([127.0.0.1]:42849 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pyVg1-0000Fo-J6
	for submit <at> debbugs.gnu.org; Mon, 15 May 2023 06:43:37 -0400
Received: from mail-ot1-f53.google.com ([209.85.210.53]:61679)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@HIDDEN>) id 1pyVg0-0000Fb-2V
 for 62116 <at> debbugs.gnu.org; Mon, 15 May 2023 06:43:36 -0400
Received: by mail-ot1-f53.google.com with SMTP id
 46e09a7af769-6aaf52ff35bso8815991a34.2
 for <62116 <at> debbugs.gnu.org>; Mon, 15 May 2023 03:43:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1684147410; x=1686739410;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=B/x3znmmYJlIfQOtEXi8oCckFTW8GuC+u01ToOpJzAA=;
 b=YUB+EYPpMmjq0XFRCQBVWdAuXPr0WVboBQHJkXpEoFHymcmGIhBNHeGBa/JXrV+q5S
 0en35crIRXszfXzNJO+ut5c0HRcq5B1krSTRUo+AzRkrKRjJe3EVxEU6yB/nMEx5Nabq
 M9UWOqLH6q4vPE9W+5LUZIBUHMYlv+ezMcNVZMEgDoKnLbOecgjWt6LvSUo+mFk1V5QI
 AcDhpR2KorOZdoRItA6XEmNl1q5+cDoFxXiWeaSNjtvnDX/uMfBDzmcL7laSd//HiBoo
 YmVy63cEuVP0pEnKFdcnCFKGpYqnBK/5gIzRkUPxYjho7sItcxKCY2BWm47DUOGKH2Be
 Qn0Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1684147410; x=1686739410;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=B/x3znmmYJlIfQOtEXi8oCckFTW8GuC+u01ToOpJzAA=;
 b=lc7VCCA/eBLZc6UzJtQIK0GJbrMwPo4xDC+sxutByvfh6OOSRLHznWRE5nONmjNhSZ
 TNNIynFa+gmwx2Bfp6lwge1dfP3j9afEyG0lSjHHm9UZJpD8ceVhwbnNFO8/4b67J+Cy
 xhjGvJfkmuxJvDwHCql67qQJRuyw0eioqDmLVoJGuGuFrHYgz5sZu3F8H136UrRr3vn6
 FQi6maGMceYa7BV0/bbF2OKZ9NTU3f7yPvUI08vm6d04dajmjShY/OTXcvJjYyl6WWil
 yvD2W7dGKPKa5hYDu+7a/hmeaGfIS9c4XxqOpMHYOjDZg7L7KfoE6n2PudaDWaJh6jhm
 Q0qw==
X-Gm-Message-State: AC+VfDzMw4K0486h7j4wpGwBNxmmjHTuaQujVRRvW5aPAtXJjKIAgTzr
 DV6wQ0lpRHOhPkJ5f1wGy98Zuq2VsjOVsIRfpi0=
X-Google-Smtp-Source: ACHHUZ6xu+C0/mKsGxvJobup3YUvHgsXryrR+Up5mviewKVqSmXty+Qylk2uOKXaeD1XbITt3ty01pI8zFB7dKYpWYg=
X-Received: by 2002:a05:6808:2907:b0:392:6e33:28eb with SMTP id
 ev7-20020a056808290700b003926e3328ebmr9800069oib.13.1684147410364; Mon, 15
 May 2023 03:43:30 -0700 (PDT)
MIME-Version: 1.0
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN> <87v8j7vy48.fsf@HIDDEN>
 <83r0tuv62t.fsf@HIDDEN> <874jp8gu8a.fsf@HIDDEN>
 <838re3jowg.fsf@HIDDEN> <87ttwqsow9.fsf@HIDDEN>
 <87ttwpbpaj.fsf@HIDDEN>
 <875y93arek.fsf@HIDDEN>
 <CALDnm52V_B7p_Eg-VgzOcTpy206fEb1Z96xs4+5=aT3R3UBsmg@HIDDEN>
 <87h6sla14k.fsf@HIDDEN> <871qjm5pzk.fsf@HIDDEN>
 <877ctc8rc9.fsf@HIDDEN> <87wn1c4f65.fsf@HIDDEN>
 <87353y91p1.fsf@HIDDEN>
 <CALDnm52U-pKnc4hYhS5_TTPam4WyR45q8xnKUQtj8Lx-=NT=8A@HIDDEN>
In-Reply-To: <CALDnm52U-pKnc4hYhS5_TTPam4WyR45q8xnKUQtj8Lx-=NT=8A@HIDDEN>
From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Date: Mon, 15 May 2023 11:45:37 +0100
Message-ID: <CALDnm52RWX0av_L688Yk_cGNmD2AssgJ-nB11GaCKmEY1viWGQ@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
To: Felician Nemeth <felician.nemeth@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62116
Cc: sebastian.poeplau@HIDDEN, adonovan@HIDDEN, 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Sun, May 14, 2023 at 8:19=E2=80=AFPM Jo=C3=A3o T=C3=A1vora <joaotavora@g=
mail.com> wrote:

> > URI.  So if it cannot open the file, because the user does not have the
> > required permissions, it is too late to send an error to the server.
>
> Oof, you're right.  That's why I didn't want the async version.  Hmm, so
> either we go back to the sync version (and solve the problems that that m=
ay
> bring -- which AFAICT are only speculations about imenu/which-func at thi=
s
> point) or we do some file-readable-p checking.
>
> Though the latter isn't horrible, ideally we would just proclaim that
> putting request-generating hooks into the major-mode hook isn't allowed.
> Because it's a bad idea anyway, since a mode hook is supposed to be cheap=
.

Scratch that.  It's true that it's a bad idea in this particular case, but
my proposal is far from "ideal".  The right thing to do is to extend jsonrp=
c.el
so that it allows asynchronous request dispatchers.  Not only would this so=
lve
the "needs to run in separate stack frame problem" but it would solve futur=
e
problems where Elisp JSONRPC endpoints need to contact other potentially
slow endpoints.

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 a=
sync.

Jo=C3=A3o




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 15 May 2023 08:49:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 15 04:49:11 2023
Received: from localhost ([127.0.0.1]:42703 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pyTtG-0005Ci-V7
	for submit <at> debbugs.gnu.org; Mon, 15 May 2023 04:49:11 -0400
Received: from mail-ot1-f51.google.com ([209.85.210.51]:48242)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@HIDDEN>) id 1pyTtE-0005CU-MX
 for 62116 <at> debbugs.gnu.org; Mon, 15 May 2023 04:49:10 -0400
Received: by mail-ot1-f51.google.com with SMTP id
 46e09a7af769-6ab1942ea59so4717336a34.0
 for <62116 <at> debbugs.gnu.org>; Mon, 15 May 2023 01:49:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1684140543; x=1686732543;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=mrQBAJWO0K5lw6j4no+hYrsnsMiOtlfOCLfcCE5mMd0=;
 b=f502QGN96E1z9D6CAFlggtSLeBDhdloidNMTftaQVB5yTfEhJTBEA0bsrb0DZ2BczD
 RudTIaM97cxyRZ/AULM4iU1sblH9jODFFAv3+Aln9gaB0663BYQpo+hhGNUtet78BUK9
 QlX8k+5gVCDWQLEz17xbvFvjv4Lz1soyiKLd3AdlsIw1h6O3biPF5LN9lUS1oLIpy9NJ
 5Isu2TSD8htGXLt6U0o95UqyOOfh9TEwmw7DaRHGLcLO483p2HaNKt1pPcI+oAVp4bxg
 zQhfLFSRVgL7TdcP+snCyYppwIK2aZLI2QXBXhF+GubZ18W7VzrLryUYuHJ4L+5ptB0s
 cynQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1684140543; x=1686732543;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=mrQBAJWO0K5lw6j4no+hYrsnsMiOtlfOCLfcCE5mMd0=;
 b=AoC5w36fC9FZUBJxVHBJtg4tW+W7fcNDXCBdu8QGarBrRtFQIyhBLikDOvR8ItquS/
 SG0ozzSs8cl6XXWAhvMD8J2NZ5JRoTH/EdV2uQEIe6MIUsGxH/Zb6LPERazmV3/mMuWO
 ttgiQzl8dhc4V5g/qyono/4SwMXtYGI8PHJmt/0nR8SmWdeMq31Y3DqMi5uOPcVEyWoG
 BbOK5dZ0rFE8ryOgS8Wdm6uZCvcOqR2w2pB32KWOIZ6Xtzky8M7ZkySIxmedJLzNrZSw
 OrmZcQ3w8HG0a5byBXuBr2OMR2ygVGusuSTRilTz7FxqMLykPQOSRMbdjxvSACQSAk96
 uA6Q==
X-Gm-Message-State: AC+VfDwU470PjRMzDWm5P/FGTlz189Img11wZG9c/xExdlrWKQGxslFB
 R2Kt6gXNoomgK3C3ntcofcyrotDJHHz2iDA+Uuk=
X-Google-Smtp-Source: ACHHUZ4+2ag8Z4Oj1mukkWwG6i4779ghEMbZw3Kiz7soaDa1Y82RsFLOBUESb9cNv8bCtdI7r0CQ5kJbX1oUS0bdwjQ=
X-Received: by 2002:aca:d706:0:b0:396:1c16:9885 with SMTP id
 o6-20020acad706000000b003961c169885mr251922oig.33.1684140542691; Mon, 15 May
 2023 01:49:02 -0700 (PDT)
MIME-Version: 1.0
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN> <87v8j7vy48.fsf@HIDDEN>
 <83r0tuv62t.fsf@HIDDEN> <874jp8gu8a.fsf@HIDDEN>
 <838re3jowg.fsf@HIDDEN> <87ttwqsow9.fsf@HIDDEN>
 <87ttwpbpaj.fsf@HIDDEN>
 <875y93arek.fsf@HIDDEN>
 <CALDnm52V_B7p_Eg-VgzOcTpy206fEb1Z96xs4+5=aT3R3UBsmg@HIDDEN>
 <87h6sla14k.fsf@HIDDEN> <871qjm5pzk.fsf@HIDDEN>
 <CAPVWWDUEnvic0jDx40g_Ju7yLG-YBCXNU8SCQy=Hp9Rn60c39Q@HIDDEN>
In-Reply-To: <CAPVWWDUEnvic0jDx40g_Ju7yLG-YBCXNU8SCQy=Hp9Rn60c39Q@HIDDEN>
From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Date: Mon, 15 May 2023 09:48:50 +0100
Message-ID: <CALDnm51-Rj_QseDvbnAd9uHQ9FP2+2-DscPc9BVe3RFkfjY8CA@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
To: Alan Donovan <adonovan@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62116
Cc: sebastian.poeplau@HIDDEN, Felician Nemeth <felician.nemeth@HIDDEN>,
 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Fri, May 12, 2023 at 9:46=E2=80=AFPM Alan Donovan <adonovan@HIDDEN> =
wrote:
>
> Thanks Joao,
>
> I quickly tried this patch, and found two problems.
>
> The first is that, because eglot-widening uses save-excursion, it
> doesn't leave the cursor in the correct position; it merely jumps
> there for a moment and then goes back to wherever it was before.
> Removing the eglot-widening is an effective workaround.

OK, I'll have a look.

> The second issue is that Emacs still often gets stuck making a
> recursive RPC, as previously discussed. I interrupted it using
> toggle-debug-on-quit and recorded the emacs Lisp function call stack.
> I've lightly tidied it to omit arguments and non-function sexprs:
>
>   accept-process-output
>   jsonrpc-request textDocument/documentSymbol
>   eglot-imenu
>   run-hooks(after-change-major-mode-hook)
>   run-mode-hooks(go-mode-hook)
>   go-mode()
>   set-auto-mode-0(go-mode nil)
>   set-auto-mode--apply-alist
>   set-auto-mode
>   normal-mode
>   after-find-file
>   find-file-noselect-1 foo.go
>   find-file-noselect foo.go
>   eglot-handle-request window/showDocument
>   jsonrpc-connection-receive window/showDocument
>   jsonrpc--process-filter
>
> In short the handling of the showDocument downcall causes eglot to
> find-file a new Go source file, whose go-mode hooks cause a
> documentSymbol upcall to be sent to the server, which then blocks
> indefinitely as it is still in the  middle of whatever active request
> sent the showDocument downcall.
>
> I hope this was helpful.

It was, at least to confirm that you do have eglot-imenu
in your go-mode-hook somehow.  I say "somehow" because it's still
not clear why eglot-imenu is in there. I've asked you this already
in the past, but maybe I wasn't clear.  Can you try to reproduce
these problems with a controlled experiment from Emacs -Q? That
means "Emacs without any customizations".

Also not immediately clear is if you tried the patch
I attached earlier or if you tried the most recent
code I ended up pushing to the emacs master branch.
From your backtrace, I'm fairly sure you tried the
former.  Please try the latter and report back (and
if possible try it from a non-user-configuration
Emacs -Q run).

Jo=C3=A3o




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 14 May 2023 19:17:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 14 15:17:26 2023
Received: from localhost ([127.0.0.1]:41591 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pyHDi-0004Xr-JL
	for submit <at> debbugs.gnu.org; Sun, 14 May 2023 15:17:26 -0400
Received: from mail-oo1-f46.google.com ([209.85.161.46]:44114)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@HIDDEN>) id 1pyHDh-0004Xc-3D
 for 62116 <at> debbugs.gnu.org; Sun, 14 May 2023 15:17:25 -0400
Received: by mail-oo1-f46.google.com with SMTP id
 006d021491bc7-54fb7dc3456so3192195eaf.0
 for <62116 <at> debbugs.gnu.org>; Sun, 14 May 2023 12:17:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1684091839; x=1686683839;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=WkR4vOLCJvPf1SMB6qIKMpei33/Qx4PNxalFhDaEjGE=;
 b=eGWt2PZKIt9Mg+Fx4yvULXfVppOBSiKLUKbQG93GKqkExydy1BkX7Xnm+00c9mCa96
 r4jx53OpRo4NmIwEubG8qMwwO9Ns3BS06HK8H3b1rek+/LEzL43wcMdInb3EN1hG/SzN
 /nlUCWr86Hhlo2tMGUe8wjaY2k8vZEEUFtEBT1TXfYlCjzBTX+xXM3KnJWS/niEscnSW
 n1ZGMxi2rlD2SzE5dJNfVLrlS3BuFfxYHd6evnQDj7n+I2Df6mUXTkfSycyc61bqCmCk
 4kgSCS/bLwdW4Go0eGavEfUt8VwnqhW1o8EWpmUqZrxxFeKkSbPgWkx/UGZjWXqOOFNJ
 XC7A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1684091839; x=1686683839;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=WkR4vOLCJvPf1SMB6qIKMpei33/Qx4PNxalFhDaEjGE=;
 b=NIffV9J5l8JgC3telzvJ8R2/c/QPBiG4QreiI5FIV4CianGmQqn/UYZaNP9dVK+cbZ
 5pSeF4QtSNpmqvasFuB7QdyqiRQ2bjwdQSZft25bbgVuzVjwUC8t9eXc0tusbH+6Zf0Q
 nQ02lUAjIb7FRsg7onORHNxh5Nk33WJnX3uM3Sj4MVS0RcTUylU15gEwIzllxM7xjhcl
 uMPthai8yn8Msg6MwHUW1VJYGHfXhMyd+MXecpXSx7YqlmrfaImhsuMMiycgRIm6NPUS
 Zhba94GB0NX7j1HxcbrGrnwvc0oVn7S1C+2ul+b3MEfbBLGTaG2D+N2U2Ek+EL413iqA
 eQow==
X-Gm-Message-State: AC+VfDx7b+XBIMQsYsb+z0wYr5wZmWacDauMYYWhuh9NubivSZpOrvAr
 CDFIqpx78MCEYJm93nc5Qk5V73oJS3MgcYXgdzk=
X-Google-Smtp-Source: ACHHUZ7Ny5L0pDh4/rjYR/wxWvB1oa31aIduKmsUrhdnQBDlQmrQwMY8nxZjMcR/tt2Wy1RnOy3vkYPPrMA6dfulzSQ=
X-Received: by 2002:a05:6808:10d1:b0:396:cd:82b1 with SMTP id
 s17-20020a05680810d100b0039600cd82b1mr1368477ois.2.1684091839511; Sun, 14 May
 2023 12:17:19 -0700 (PDT)
MIME-Version: 1.0
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN> <87v8j7vy48.fsf@HIDDEN>
 <83r0tuv62t.fsf@HIDDEN> <874jp8gu8a.fsf@HIDDEN>
 <838re3jowg.fsf@HIDDEN> <87ttwqsow9.fsf@HIDDEN>
 <87ttwpbpaj.fsf@HIDDEN>
 <875y93arek.fsf@HIDDEN>
 <CALDnm52V_B7p_Eg-VgzOcTpy206fEb1Z96xs4+5=aT3R3UBsmg@HIDDEN>
 <87h6sla14k.fsf@HIDDEN> <871qjm5pzk.fsf@HIDDEN>
 <877ctc8rc9.fsf@HIDDEN> <87wn1c4f65.fsf@HIDDEN>
 <87353y91p1.fsf@HIDDEN>
In-Reply-To: <87353y91p1.fsf@HIDDEN>
From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Date: Sun, 14 May 2023 20:19:25 +0100
Message-ID: <CALDnm52U-pKnc4hYhS5_TTPam4WyR45q8xnKUQtj8Lx-=NT=8A@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
To: Felician Nemeth <felician.nemeth@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62116
Cc: sebastian.poeplau@HIDDEN, adonovan@HIDDEN, 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Sun, May 14, 2023 at 8:02=E2=80=AFPM Felician Nemeth
<felician.nemeth@HIDDEN> wrote:
>
> >> Even when takeFous is nil, shouldn't we still at least raise the frame=
?
> >> Otherwise Emacs might not show the document.
> >
> > I don't understand.  Can you show this problem. , I think display-buffe=
r
> > ensures the buffer is displayed.  It doesn't guarantee that it is
> > visible in the context of the windowing system, but that's another
> > matter.
>
> I was worried about the case when there are two frames: frame A is in
> focus, and frame B is minimized but contains the target buffer.  But
> you're right.  display-buffer does raise frame B and keeps the focus in
> frame A.

I hadn't thought of this, but good to know that display-buffer handles
it.

> > I pushed a version with the above adjustments to master, as we're
> > converging anyway and it's easier than trading patches.
>
> The pushed version is good, but there is one minor problematic detail.
> It returns "success" even before it tries to find-file the requested
> URI.  So if it cannot open the file, because the user does not have the
> required permissions, it is too late to send an error to the server.

Oof, you're right.  That's why I didn't want the async version.  Hmm, so
either we go back to the sync version (and solve the problems that that may
bring -- which AFAICT are only speculations about imenu/which-func at this
point) or we do some file-readable-p checking.

Though the latter isn't horrible, ideally we would just proclaim that
putting request-generating hooks into the major-mode hook isn't allowed.
Because it's a bad idea anyway, since a mode hook is supposed to be cheap.
Maybe eglot-request could error out (or warn and return nil) when it
detects it's running in the mode hook.  FWIW my new breadcrumb.el extension=
,
which also uses imenu, _can_ be put in the mode hook because it calls the
imenu-building, request-generating function asynchronously.  So it isn't
a problem there.

I wonder if Alan could inform us about the contents of his go-mode-hook,
to check if which-function-mode lives there.  That would dispel the
speculation.

Jo=C3=A3o




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 14 May 2023 19:02:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 14 15:02:15 2023
Received: from localhost ([127.0.0.1]:41576 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pyGz0-0004AI-Nc
	for submit <at> debbugs.gnu.org; Sun, 14 May 2023 15:02:15 -0400
Received: from mail-wm1-f45.google.com ([209.85.128.45]:57707)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <felician.nemeth@HIDDEN>) id 1pyGyx-0004A0-Mb
 for 62116 <at> debbugs.gnu.org; Sun, 14 May 2023 15:02:13 -0400
Received: by mail-wm1-f45.google.com with SMTP id
 5b1f17b1804b1-3f4249b7badso80086045e9.3
 for <62116 <at> debbugs.gnu.org>; Sun, 14 May 2023 12:02:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1684090924; x=1686682924;
 h=mime-version:face:user-agent:message-id:in-reply-to:date:references
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=Lh523KtBQvc+LRepxHoscHoDyQtrJ06/JeKm+z5IyRU=;
 b=Lx6SAUJCKesxJelVTuuShp3SM6nFdQrkhJdppfhiczkxtbmBhDS/46N/Cq/VXnK4+a
 7gyQ1yzDG9H6LSJV7yqEys/gKfMOj2oAFcBZd3N1mMa6gb6oHYD/uogrSa5unmLWeB4X
 pAOy1CwBwTI61Bx1dolIKcfQ+uhg6JacTJWFY7EcfaReTuKfR7pF6tjuKmIqbka/+B5g
 9p5pTL4X7SxYtP3cbeU2sMw2BnJGEC5nPr4dr8Wn07QQrWxEv4sezs9XRa3iTXHD/P5f
 sby3wB2hzeukKTWmD6nbyxfI4zaUqtpS9Y1XOld7wRQ9h7hKJ5e6UBvpSf+1Iek0sBqH
 quGw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1684090924; x=1686682924;
 h=mime-version:face:user-agent:message-id:in-reply-to:date:references
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=Lh523KtBQvc+LRepxHoscHoDyQtrJ06/JeKm+z5IyRU=;
 b=ieR4zxg9YrGFmnAgUmFKj+e8jh+BZ2uFtn1JkVr7XWQ9n6A67tNUma7D1K7IvagO9j
 xC7XKpHvPF0jruwRQb4uyK1x19PiWmrjoBGzt9AODiOeiVWr3AoNgco2BCYZgqbrsQ1u
 8aqSNB9bZuUfyvS/f+4yfXND8B7Hj9bqBv4lVH1ZBkCTvhdQgSE14/G7/ICM60RPfV6E
 dAKYAAE6/wpY9KPDxBDQDIBcM6sqjgMgW+c9+xRx1wlGsfnTFFpjC0oCRbwMxCrJ+TPv
 S2ovtkqqV3TEzY7iiKjg+Cg3+tuh09s4oY9sk3rhI5eUwfx0PiPf+g5Pvk7V9F1rY9Xa
 8i7A==
X-Gm-Message-State: AC+VfDzO+tV3b3yJ69Bbn0m9z99mCnQaZUao3cFWC53INnDjVLQXW3Cq
 UA412EkXwX2Y7Yu41IzE+J0=
X-Google-Smtp-Source: ACHHUZ5ShiJdVAPRiaWPDKowEV2dWXVkVUs2BxeafQYtptEIjWIfXz0g7NeykeNow5MWGBuPariEMg==
X-Received: by 2002:adf:fccb:0:b0:306:3899:ccbf with SMTP id
 f11-20020adffccb000000b003063899ccbfmr22658073wrs.14.1684090924396; 
 Sun, 14 May 2023 12:02:04 -0700 (PDT)
Received: from betli.gmail.com (catv-89-134-210-182.catv.fixed.vodafone.hu.
 [89.134.210.182]) by smtp.gmail.com with ESMTPSA id
 d18-20020adfe852000000b002fe13ec49fasm29882978wrn.98.2023.05.14.12.02.03
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 14 May 2023 12:02:03 -0700 (PDT)
From: Felician Nemeth <felician.nemeth@HIDDEN>
To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN>
 <87v8j7vy48.fsf@HIDDEN> <83r0tuv62t.fsf@HIDDEN>
 <874jp8gu8a.fsf@HIDDEN> <838re3jowg.fsf@HIDDEN>
 <87ttwqsow9.fsf@HIDDEN> <87ttwpbpaj.fsf@HIDDEN>
 <875y93arek.fsf@HIDDEN>
 <CALDnm52V_B7p_Eg-VgzOcTpy206fEb1Z96xs4+5=aT3R3UBsmg@HIDDEN>
 <87h6sla14k.fsf@HIDDEN> <871qjm5pzk.fsf@HIDDEN>
 <877ctc8rc9.fsf@HIDDEN> <87wn1c4f65.fsf@HIDDEN>
Date: Sun, 14 May 2023 21:02:02 +0200
In-Reply-To: <87wn1c4f65.fsf@HIDDEN> (=?utf-8?Q?=22Jo=C3=A3o_T=C3=A1vor?=
 =?utf-8?Q?a=22's?= message of "Sat, 13 May 2023 12:57:38 +0100")
Message-ID: <87353y91p1.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEUMBwgHAgMFAAGPjY7/
 //80MDHq6eqJt3pKAAABr0lEQVQ4jX2UzZKDIAzHqR177q7TPbtx2HMr6guQcrbY9txZ0fd/hA0f
 onXazcEJ/CD8E4Js8/HS9mwjXtqeMRxHXJkakTEm4b4GPVQW8PU8ov4fQCqeThlF60MBWdo1IXzd
 2nEEZE7CEAZLwI0N/gJAhTj7ESQAX4gPgO8lyI+cvgViSVPlNomAj2M9gW40eg7VWY3cATjUcyiO
 Z+i03cFruGLYoUR7VyU3HihdmCEVhoDN65FXkpbSxkomOzsTQN/gySaodGb9Gdi1oSRXP46gdBWh
 LcUKJNdeGCWac74GKakmne0aHCFvyqJPYLsCFAVlhRTvGdzMdLHqtgRyUulyXIAH7CYQ3AB0Nody
 JQhAkq/qtOnbjhxdzYDkXPxlH5y4WdUAeUcX1NVJ6GR7UQEYPGWoAnA36OQNn5lRRp38vHTAp9Br
 LoTmvlPPDoRCKzpjG1SXT89AaT5l456BamJuMcs+NIOMzJ/s5dI6yUVcrARlruwOebfdv6gunTn4
 ww3+QjGBEn5suVyLHoSGvAqREuDLN+iqZ+VcFg+HBbsJUU9+FZthbez9T+bdb+kPv2Ls6ct3hTkA
 AAAASUVORK5CYII=
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62116
Cc: sebastian.poeplau@HIDDEN, adonovan@HIDDEN, 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>> Even when takeFous is nil, shouldn't we still at least raise the frame?
>> Otherwise Emacs might not show the document.
>
> I don't understand.  Can you show this problem. , I think display-buffer
> ensures the buffer is displayed.  It doesn't guarantee that it is
> visible in the context of the windowing system, but that's another
> matter.

I was worried about the case when there are two frames: frame A is in
focus, and frame B is minimized but contains the target buffer.  But
you're right.  display-buffer does raise frame B and keeps the focus in
frame A.

> I pushed a version with the above adjustments to master, as we're
> converging anyway and it's easier than trading patches.

The pushed version is good, but there is one minor problematic detail.
It returns "success" even before it tries to find-file the requested
URI.  So if it cannot open the file, because the user does not have the
required permissions, it is too late to send an error to the server.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 13 May 2023 11:55:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 13 07:55:33 2023
Received: from localhost ([127.0.0.1]:36160 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pxnqW-0001Ab-HR
	for submit <at> debbugs.gnu.org; Sat, 13 May 2023 07:55:32 -0400
Received: from mail-wr1-f43.google.com ([209.85.221.43]:54275)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@HIDDEN>) id 1pxnqV-00019w-9X
 for 62116 <at> debbugs.gnu.org; Sat, 13 May 2023 07:55:31 -0400
Received: by mail-wr1-f43.google.com with SMTP id
 ffacd0b85a97d-3062db220a3so7095662f8f.0
 for <62116 <at> debbugs.gnu.org>; Sat, 13 May 2023 04:55:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1683978925; x=1686570925;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=HJ+sf3yeL56hR1uAmKJulbGwnUZ/jH42l7jsE45wGdM=;
 b=m+vcsy8E2oUdX/7NWFy3UK3c2e9/4I5UNwaS8O9cEzv+PmHsX1YTjImjVIxLRywLj+
 qEDxtpW6qIm6oLx1n7mVYC07nK+VoRE2XHgSbiUxaBeqkDD4O8abEYr/tU04sYlycnkd
 okO6zD+0oXAUKtJKd6Jd8NasyUFsiof40VlkR/YHllSaH8Sv4IBFaDxzz8myGs+V7hRG
 OS3iUVTkXSjrbmoZ37UhYZFbMQI+xClkOOdqi/LgbNp07VhDbPP2bLFY40YMZ5xbt+1p
 NV3xWrCV7DZRmMV0KYHdDq0S1GJi2xulf6CvWFrd7DtxwJqrata9Ynu/WSyqyL5pyywL
 7gPg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1683978925; x=1686570925;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=HJ+sf3yeL56hR1uAmKJulbGwnUZ/jH42l7jsE45wGdM=;
 b=AwX713mE/yfzFihE9l/OSR5BKSYFn/3d3B/yZvs6Eev3fvxzxDduBxkJRr/tX+5qV+
 vQfe3+EYUCpqf2+b8A37VAksNgWq/nhx14JM3Pv15Df4Qbh5NpreZogyLaI01gVzldPW
 avaZHh2xzGIz4LTlCw2xCjqkXB/NLRoBbNt9F0JaL8sf7T0o1XSvIyCqV5vvEgQddE4f
 cLDEIywAKfv/6L5PfeeD6aFUTyDPOlfIMLetgYt8AJJd5K85cDS/T13TeDDvjlQPct3O
 uISKDW0H5mdp0P3qnT9thRUqkZK7Xr+YICp+GqD2+L1CMWgJNhDoK4g61jdDIvbjGm3A
 3vkA==
X-Gm-Message-State: AC+VfDzdhrGVaP5wXyeNdrwpLwIIPCLQPchsKwc/Heh14AtHbJqweotx
 o6caYzX8JynK1ANmssAawFA=
X-Google-Smtp-Source: ACHHUZ6blyN/uKzgW8myMyfRrh8F7e5/Y8l0l5j5iBTikTD84dbOK+BN9YNmdcHiaZcSdcj4IjwtFg==
X-Received: by 2002:a05:6000:104b:b0:2e4:eebe:aee3 with SMTP id
 c11-20020a056000104b00b002e4eebeaee3mr17525135wrx.60.1683978925092; 
 Sat, 13 May 2023 04:55:25 -0700 (PDT)
Received: from krug (87-196-72-49.net.novis.pt. [87.196.72.49])
 by smtp.gmail.com with ESMTPSA id
 z9-20020a05600c114900b003f4069417absm28747507wmz.24.2023.05.13.04.55.23
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 13 May 2023 04:55:24 -0700 (PDT)
From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
To: Felician Nemeth <felician.nemeth@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
In-Reply-To: <877ctc8rc9.fsf@HIDDEN> (Felician Nemeth's message of
 "Sat, 13 May 2023 12:21:10 +0200")
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN>
 <87v8j7vy48.fsf@HIDDEN> <83r0tuv62t.fsf@HIDDEN>
 <874jp8gu8a.fsf@HIDDEN> <838re3jowg.fsf@HIDDEN>
 <87ttwqsow9.fsf@HIDDEN> <87ttwpbpaj.fsf@HIDDEN>
 <875y93arek.fsf@HIDDEN>
 <CALDnm52V_B7p_Eg-VgzOcTpy206fEb1Z96xs4+5=aT3R3UBsmg@HIDDEN>
 <87h6sla14k.fsf@HIDDEN> <871qjm5pzk.fsf@HIDDEN>
 <877ctc8rc9.fsf@HIDDEN>
Date: Sat, 13 May 2023 12:57:38 +0100
Message-ID: <87wn1c4f65.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 3.6 (+++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: Felician Nemeth writes: >> + uri external takeFocus
 selection)
 >> + "Handle request window/showDocument." >> + (if (eq external t)
 (browse-url
 uri) >> + (let* (;; requests run with a let-bound `eglot--cached-server',
 >> + ;; [...] 
 Content analysis details:   (3.6 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (joaotavora[at]gmail.com)
 3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
 [87.196.72.49 listed in zen.spamhaus.org]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [209.85.221.43 listed in list.dnswl.org]
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [209.85.221.43 listed in wl.mailspike.net]
X-Debbugs-Envelope-To: 62116
Cc: sebastian.poeplau@HIDDEN, adonovan@HIDDEN, 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 2.6 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  Felician Nemeth writes: >> + uri external takeFocus selection)
    >> + "Handle request window/showDocument." >> + (if (eq external t) (browse-url
    uri) >> + (let* (;; requests run with a let-bound `eglot--cached-server',
    >> + ;; [...] 
 
 Content analysis details:   (2.6 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
                             [209.85.221.43 listed in wl.mailspike.net]
  3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
                             [87.196.72.49 listed in zen.spamhaus.org]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [209.85.221.43 listed in list.dnswl.org]
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (joaotavora[at]gmail.com)
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager

Felician Nemeth <felician.nemeth@HIDDEN> writes:

>> +           uri external takeFocus selection)
>> +  "Handle request window/showDocument."
>> +  (if (eq external t) (browse-url uri)
>> +    (let* (;; requests run with a let-bound `eglot--cached-server',
>> +           ;; but when finding files from handlers, this fools
>> +           ;; `eglot--maybe-activate-editing-mode'.
>> +           (eglot--cached-server nil))
>
> (I don't understand this part.)

If you look up to near line 1308, you'll notice that the client handlers
for server requests run with `eglot--cached-server` let-bound.  This, in
turn makes every subsequent call to `eglot--maybe-a-e-m` activate the
eglot--managed-mode minor mode.  There are, unexpectedly, a couple of
calls to `eglot--maybe-a-e-m` but that's due to find-file's logic which
surprisingly temporarily activates another major mode when finding a
file.  Apparently this is how it's always been.  That first mode is
activated by a call to `major-mode` and then is replaced by a call to
the actual major-mode function, in this case `go-mode`.

>> +      (with-current-buffer (find-file-noselect (eglot--uri-to-path uri))
>> +        (cond (takeFocus
>> +               (pop-to-buffer (current-buffer))
>
> Somehow switch-to-buffer feels more natural to me.  But pop-to-buffer is
> probably a better choice.

I think you can do `display-buffer-alist` things to control it.

>> +               (select-frame-set-input-focus (selected-frame)))
>> +              ((display-buffer (current-buffer))))
>
> Even when takeFous is nil, shouldn't we still at least raise the frame?
> Otherwise Emacs might not show the document.

I don't understand.  Can you show this problem. , I think display-buffer
ensures the buffer is displayed.  It doesn't guarantee that it is
visible in the context of the windowing system, but that's another
matter.

>
>> +  '(:success t))
>
> Regarding Alan's problem, one could argue that it can also be fixed on
> the server-side.  However, there might be a general, but complex fix on
> Emacs' side as well: imenu can be modified to asynchronously generate
> its index when it just wants to show it in the menu (and not to users'
> direct request).  Then the request of :textDocument/documentSymbol can
> be non-blocking as well.  A simpler fix is to delay the opening of the
> file.

Yes, right.  Making imenu or textDocument/documentSymbol asynchronous
would be too complex and async doesn't really fit in there.  I think
Alan's problem indeed arises with something like imenu being in the
major-mode's hook, perhaps on behalf of which-func-mode.  But that was
never confirmed.  In the latest version of the patch I've just put a
run-with-timer in the Eglot request handler.  It should solve the
conjectured Alan problem and also doesn't require the obscure
eglot--cached-server hack above.

>> I was about to push it, but let's hear your opinions first
> It is great, and I'd be happy if it went in as is.  Thank you.

I pushed a version with the above adjustments to master, as we're
converging anyway and it's easier than trading patches.

Jo=C3=A3o




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 13 May 2023 10:21:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 13 06:21:21 2023
Received: from localhost ([127.0.0.1]:36029 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pxmNM-0004Uc-VE
	for submit <at> debbugs.gnu.org; Sat, 13 May 2023 06:21:21 -0400
Received: from mail-wm1-f47.google.com ([209.85.128.47]:44114)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <felician.nemeth@HIDDEN>) id 1pxmNK-0004UO-JN
 for 62116 <at> debbugs.gnu.org; Sat, 13 May 2023 06:21:19 -0400
Received: by mail-wm1-f47.google.com with SMTP id
 5b1f17b1804b1-3f4449fa085so31395785e9.0
 for <62116 <at> debbugs.gnu.org>; Sat, 13 May 2023 03:21:18 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1683973273; x=1686565273;
 h=content-transfer-encoding:mime-version:face:user-agent:message-id
 :in-reply-to:date:references:subject:cc:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=mZCXghrod0nt/EKhL8bSglC8Fm6uUVL5FgwNxPVe08Y=;
 b=N3MS5PXA2t+rIJRapymC4W+Ygpl86ULq5qtZFMnr5+kiX+fHqQUx9U2Xrs3trerOFO
 bm2hruAXKwy1ZQvsqOHXu4J8mmI/zZN3tpj1BjqnA2njz/soXf0pUjjTIQE9oc+VFpC5
 dZf+sbzRi4eQAannUYm5vhtKtbEHf3vn9///23puawsiSai9gS7edyc6EkbuWxxXQasi
 DS6q+xNeTrenrOxqbA7s+qJ+tcl2u5xgu9dcBfmU9VlErJ+ZtHton8yyliTGVfpbafwm
 QaXOZnNPmUvUebqksn0UT/uhliS2nP7pWHihEsK0S32FXmGLJby2p6fFB7BarJ0Aaa+W
 gNCA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1683973273; x=1686565273;
 h=content-transfer-encoding:mime-version:face:user-agent:message-id
 :in-reply-to:date:references:subject:cc:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=mZCXghrod0nt/EKhL8bSglC8Fm6uUVL5FgwNxPVe08Y=;
 b=DCSJn81+F7OUlQRbchbGqa9n7AEuk57G+hssKJg5e7kGQaXEHZ4aVd8KfoTRbdUyYk
 C8VdTIdryFe/oZ2dh3r45VGtJDWVSVckE3ECSJ1iDjgGbYMx+uz06KELPFwlmleZmjwM
 Oo5tSINnZS+Z29p68rTAnAxHmr5qoAhGtw6vpIKEwjHeGO4fggcn9IXTlSCwUJd06yO0
 wYQLRUngT8+njxl/tYuzjB5f79Hb/9PcJWIWG2UOmXJYjNN5g55UAfe/vylqPCZYiKm+
 YSBHJY3CpZxKuy7EbojIbdYgEdQoAxQA/6T5F9EdS15kCexvNZ0tUmvw3oUCd6o539mK
 KJ5g==
X-Gm-Message-State: AC+VfDynfYkiL2DfL8WLrR/ob9/BMtFsR5yiZ7kvl55wBZ/zt9DFBBYY
 7lnVVOv4uzMIZ5yRhKvNjJM=
X-Google-Smtp-Source: ACHHUZ5IX0J1Is9Fds1HD+qGB3I8yuqr0z1VS6p6f8ytP9PuSOewQ0/fGNJxapCAo3bN3XjrX5vg/Q==
X-Received: by 2002:a1c:7406:0:b0:3f4:2e01:83fa with SMTP id
 p6-20020a1c7406000000b003f42e0183famr10556798wmc.26.1683973272550; 
 Sat, 13 May 2023 03:21:12 -0700 (PDT)
Received: from betli.gmail.com (catv-89-134-210-182.catv.fixed.vodafone.hu.
 [89.134.210.182]) by smtp.gmail.com with ESMTPSA id
 o19-20020a1c7513000000b003f31cb7a203sm30907196wmc.14.2023.05.13.03.21.11
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 13 May 2023 03:21:11 -0700 (PDT)
From: Felician Nemeth <felician.nemeth@HIDDEN>
To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN>
 <87v8j7vy48.fsf@HIDDEN> <83r0tuv62t.fsf@HIDDEN>
 <874jp8gu8a.fsf@HIDDEN> <838re3jowg.fsf@HIDDEN>
 <87ttwqsow9.fsf@HIDDEN> <87ttwpbpaj.fsf@HIDDEN>
 <875y93arek.fsf@HIDDEN>
 <CALDnm52V_B7p_Eg-VgzOcTpy206fEb1Z96xs4+5=aT3R3UBsmg@HIDDEN>
 <87h6sla14k.fsf@HIDDEN> <871qjm5pzk.fsf@HIDDEN>
Date: Sat, 13 May 2023 12:21:10 +0200
In-Reply-To: <871qjm5pzk.fsf@HIDDEN> (=?utf-8?Q?=22Jo=C3=A3o_T=C3=A1vor?=
 =?utf-8?Q?a=22's?= message of "Fri, 12 May 2023 01:54:07 +0100")
Message-ID: <877ctc8rc9.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEUMBwgHAgMFAAGPjY7/
 //80MDHq6eqJt3pKAAABr0lEQVQ4jX2UzZKDIAzHqR177q7TPbtx2HMr6guQcrbY9txZ0fd/hA0f
 onXazcEJ/CD8E4Js8/HS9mwjXtqeMRxHXJkakTEm4b4GPVQW8PU8ov4fQCqeThlF60MBWdo1IXzd
 2nEEZE7CEAZLwI0N/gJAhTj7ESQAX4gPgO8lyI+cvgViSVPlNomAj2M9gW40eg7VWY3cATjUcyiO
 Z+i03cFruGLYoUR7VyU3HihdmCEVhoDN65FXkpbSxkomOzsTQN/gySaodGb9Gdi1oSRXP46gdBWh
 LcUKJNdeGCWac74GKakmne0aHCFvyqJPYLsCFAVlhRTvGdzMdLHqtgRyUulyXIAH7CYQ3AB0Nody
 JQhAkq/qtOnbjhxdzYDkXPxlH5y4WdUAeUcX1NVJ6GR7UQEYPGWoAnA36OQNn5lRRp38vHTAp9Br
 LoTmvlPPDoRCKzpjG1SXT89AaT5l456BamJuMcs+NIOMzJ/s5dI6yUVcrARlruwOebfdv6gunTn4
 ww3+QjGBEn5suVyLHoSGvAqREuDLN+iqZ+VcFg+HBbsJUU9+FZthbez9T+bdb+kPv2Ls6ct3hTkA
 AAAASUVORK5CYII=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62116
Cc: sebastian.poeplau@HIDDEN, adonovan@HIDDEN, 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN> writes:

> I've now followed Alan's recipe and played around a bit with this.
> Starting from your version, I came up with this simpler patch.
>
> I was about to push it, but let's hear your opinions first

It is great, and I'd be happy if it went in as is.  Thank you.

However, ...

> +(cl-defmethod eglot-handle-request
> +  (_server (_method (eql window/showDocument)) &key
> +           uri external takeFocus selection)
> +  "Handle request window/showDocument."
> +  (if (eq external t) (browse-url uri)
> +    (let* (;; requests run with a let-bound `eglot--cached-server',
> +           ;; but when finding files from handlers, this fools
> +           ;; `eglot--maybe-activate-editing-mode'.
> +           (eglot--cached-server nil))

(I don't understand this part.)

> +      (with-current-buffer (find-file-noselect (eglot--uri-to-path uri))
> +        (cond (takeFocus
> +               (pop-to-buffer (current-buffer))

Somehow switch-to-buffer feels more natural to me.  But pop-to-buffer is
probably a better choice.

> +               (select-frame-set-input-focus (selected-frame)))
> +              ((display-buffer (current-buffer))))

Even when takeFous is nil, shouldn't we still at least raise the frame?
Otherwise Emacs might not show the document.

> +        (when selection
> +          (eglot--widening
> +           (pcase-let ((`(,beg . ,end) (eglot--range-region selection)))
> +             (goto-char beg)
> +             (pulse-momentary-highlight-region beg end 'highlight)))))))

This is a nice detail.

> +  '(:success t))

Regarding Alan's problem, one could argue that it can also be fixed on
the server-side.  However, there might be a general, but complex fix on
Emacs' side as well: imenu can be modified to asynchronously generate
its index when it just wants to show it in the menu (and not to users'
direct request).  Then the request of :textDocument/documentSymbol can
be non-blocking as well.  A simpler fix is to delay the opening of the
file.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 12 May 2023 20:47:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 12 16:47:03 2023
Received: from localhost ([127.0.0.1]:33631 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pxZfL-00073I-Bg
	for submit <at> debbugs.gnu.org; Fri, 12 May 2023 16:47:03 -0400
Received: from mail-pl1-f179.google.com ([209.85.214.179]:37009)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <adonovan@HIDDEN>) id 1pxZfH-00072n-PP
 for 62116 <at> debbugs.gnu.org; Fri, 12 May 2023 16:47:01 -0400
Received: by mail-pl1-f179.google.com with SMTP id
 d9443c01a7336-1ac65ab7432so554555ad.0
 for <62116 <at> debbugs.gnu.org>; Fri, 12 May 2023 13:46:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=google.com; s=20221208; t=1683924414; x=1686516414;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=9pnnEDKjwZRXcrkqdYdtXf2+TeqAEFYF7emcLN5UWno=;
 b=nU/gCCyCsZ4cUNn2RBX4tsd/rQnrHYG72h+pxKmuiyr+IyqKpCESyHHYPblEcndTyp
 AR93qqsq48vvQ6zpcg7VpV5liwimZpu6uhGRBG+JHD1wOKW2hX7/5rPAyOL+OucpJpVC
 N12yOAdERo4/WKkkrxDGXkkW9POISO2xTaMvDrThTSP9ic20q070scbZaWtZiIBc8wm0
 50ykTMWr+1tXthkkQjdFXuhRB/emLSaCZUNxV6XGJ9JvOYuxbP7N60nuvqJHW/tE5LvY
 q5JO8U9obnQnC8nu4c+or1GjMI6tEUXTbfccsfPYnK5znbooOhAQhmrDpskyD5fKsBwO
 pZZA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1683924414; x=1686516414;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=9pnnEDKjwZRXcrkqdYdtXf2+TeqAEFYF7emcLN5UWno=;
 b=Bi63F+bG4ca+wKzRJYV92e2gqN5HEXKxiRgZCyUsjOkXPWR06ZTkfgFjUs647c4Fnv
 m+ChzlQbSPFWXkfRK2DHHdQlvNElpNKJqSc3V2BoktF5vTzRVOSrstFyztL/3cG/NN5A
 cz/wcmHuOaTK1reamSk2TGQW4C/nfBlhMr83xWuKoAKLu2XMtvPKw360kXVhRAfGRjmY
 zZUdESX/g56ZjeNKGcvEYVZtvbJZka66PXYtr59DpbF2O+FsSfSTy5B2NYSjffL8aDkn
 Ci5OnLttJ9Dh/DMJVYmrIYWywnG9oGfRT0dT7rpq2inS9xups50OF1jktoDHclcUyXC4
 YrJA==
X-Gm-Message-State: AC+VfDzMJZe466aUKoq6tUArjw0ikaoptopQGIanpvvoInTlVDdXLrIS
 2OkOrRPAdBH4NNCHPjisFQJPAqyz5MwV/AjKI0EnoQ==
X-Google-Smtp-Source: ACHHUZ50rS+5vC2R/vG6813zZnBIzbkRYaCLlfqudb/P6aJDnTMSmNByRoij7+ks6HNUrja80hWsRZIER7gpt/ssLjU=
X-Received: by 2002:a17:902:c410:b0:1aa:ea22:8043 with SMTP id
 k16-20020a170902c41000b001aaea228043mr292654plk.7.1683924413816; Fri, 12 May
 2023 13:46:53 -0700 (PDT)
MIME-Version: 1.0
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN> <87v8j7vy48.fsf@HIDDEN>
 <83r0tuv62t.fsf@HIDDEN> <874jp8gu8a.fsf@HIDDEN>
 <838re3jowg.fsf@HIDDEN> <87ttwqsow9.fsf@HIDDEN>
 <87ttwpbpaj.fsf@HIDDEN>
 <875y93arek.fsf@HIDDEN>
 <CALDnm52V_B7p_Eg-VgzOcTpy206fEb1Z96xs4+5=aT3R3UBsmg@HIDDEN>
 <87h6sla14k.fsf@HIDDEN> <871qjm5pzk.fsf@HIDDEN>
In-Reply-To: <871qjm5pzk.fsf@HIDDEN>
From: Alan Donovan <adonovan@HIDDEN>
Date: Fri, 12 May 2023 16:46:42 -0400
Message-ID: <CAPVWWDUEnvic0jDx40g_Ju7yLG-YBCXNU8SCQy=Hp9Rn60c39Q@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -8.0 (--------)
X-Debbugs-Envelope-To: 62116
Cc: sebastian.poeplau@HIDDEN, Felician Nemeth <felician.nemeth@HIDDEN>,
 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -9.0 (---------)

Thanks Joao,

I quickly tried this patch, and found two problems.

The first is that, because eglot-widening uses save-excursion, it
doesn't leave the cursor in the correct position; it merely jumps
there for a moment and then goes back to wherever it was before.
Removing the eglot-widening is an effective workaround.

The second issue is that Emacs still often gets stuck making a
recursive RPC, as previously discussed. I interrupted it using
toggle-debug-on-quit and recorded the emacs Lisp function call stack.
I've lightly tidied it to omit arguments and non-function sexprs:

  accept-process-output
  jsonrpc-request textDocument/documentSymbol
  eglot-imenu
  run-hooks(after-change-major-mode-hook)
  run-mode-hooks(go-mode-hook)
  go-mode()
  set-auto-mode-0(go-mode nil)
  set-auto-mode--apply-alist
  set-auto-mode
  normal-mode
  after-find-file
  find-file-noselect-1 foo.go
  find-file-noselect foo.go
  eglot-handle-request window/showDocument
  jsonrpc-connection-receive window/showDocument
  jsonrpc--process-filter

In short the handling of the showDocument downcall causes eglot to
find-file a new Go source file, whose go-mode hooks cause a
documentSymbol upcall to be sent to the server, which then blocks
indefinitely as it is still in the  middle of whatever active request
sent the showDocument downcall.

I hope this was helpful.

cheers
alan




On Thu, 11 May 2023 at 20:51, Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN> =
wrote:
>
> Felician Nemeth <felician.nemeth@HIDDEN> writes:
>
> > Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN> writes:
> >
> >>> Since it advances the status quo, can this be merged?  If not, how
> >>> should we proceed?
> >>
> >> Haven't looked at it, but I'd say yes.  However, Alan Donovan
> >> has replied recently, with a recipe showcasing his particular
> >> use case.  I dont' have time to try it right now, but if you
> >> could try his recipe/use case with your solution, it would be
> >> great.
> >
> > It requires to patch and recompile gopls, which would be too much effor=
t
> > for me, unfortunately.
>
> I've now followed Alan's recipe and played around a bit with this.
> Starting from your version, I came up with this simpler patch.
>
> I was about to push it, but let's hear your opinions first (though we
> can always push and tweak it later).
>
> Jo=C3=A3o
>




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 12 May 2023 00:52:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 11 20:52:02 2023
Received: from localhost ([127.0.0.1]:53661 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pxH0s-00067S-H8
	for submit <at> debbugs.gnu.org; Thu, 11 May 2023 20:52:02 -0400
Received: from mail-wm1-f41.google.com ([209.85.128.41]:62952)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@HIDDEN>) id 1pxH0p-00066u-Ep
 for 62116 <at> debbugs.gnu.org; Thu, 11 May 2023 20:52:00 -0400
Received: by mail-wm1-f41.google.com with SMTP id
 5b1f17b1804b1-3f315735514so303544205e9.1
 for <62116 <at> debbugs.gnu.org>; Thu, 11 May 2023 17:51:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1683852713; x=1686444713;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=LQ/Z3gPzmt6/ucl7HwhUUNnj8ZLpekUh+yV6Zoypm6w=;
 b=QdbNUvI/ozv1s7v2AGyf37ElRdFxOrakrmWyjPdPdldoLY/HjgRdk97NoXAwbNmAr0
 sRLSXWTimRR+YQdOvMQa/elZdYvurcAWn2vUfIsaumuTRvbTpXZ+TqiV5EQdtuZycUsd
 9VegaYsTMtnj7m4x9sXCPP7kwslFyg2HF6ICtjgTwTWXYdG3wCrwMsG8kb1VCytVuQKe
 EVpr3S+Z6iSJub1Co5McPeV0jKYWcV2xALoVSrxrISdXgGqnqRT4v4aMElEuz0DtIhAa
 LPUUBLF5SZ0QNyZjens+j8hjoDhcPiNfFwKypaiFm78i9yc5QF9iFnyRA/H6vY4pTSZi
 gYKA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1683852713; x=1686444713;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=LQ/Z3gPzmt6/ucl7HwhUUNnj8ZLpekUh+yV6Zoypm6w=;
 b=iie0yMaFMuWPylD4YD64WmezS2WYPqCEFY4IeUZWouIU6dy1Hnc+ogOX0V4Pyjhrcb
 Aul6LrGPvc+5XqPx64QzEwGcHV9ic7Yi8lcPQU3b6OEVeCccxIYsMGW++fezHUGW5d+3
 KXT2G/kkoCRWqlsA7PMNply9AHfO0kincvhx5CxRJ2EMMXKhj3IMmSjKTLsmZWEVMr3K
 d3nFIswfd/OITmnKdl/0zE4Vp+TQsCheAiwi+bJvTgbvUkScgAK5ZKOPLNYy6sNK2qot
 fDp7GPdTdykoUCwZDow8WQPiMjGvJX8w9qABabSq4Q8TF8irSZG5iblaU1scLAkDCHCs
 gFOw==
X-Gm-Message-State: AC+VfDyKNcpsdmqlCOVKwd4mOIHhrhAI7j+bUPZlpQm5v+nWm8ofUyCi
 ICiCcCxhxAazzlQrC0jNji4=
X-Google-Smtp-Source: ACHHUZ5sbolGxY4whJESpxMvcOFQdG3RKciwrcySIqibbGivJ3ZRcHwPNMY9fSDb+YEPlljcr4Qtiw==
X-Received: by 2002:a5d:6144:0:b0:307:c6b2:4f0b with SMTP id
 y4-20020a5d6144000000b00307c6b24f0bmr2976191wrt.29.1683852713144; 
 Thu, 11 May 2023 17:51:53 -0700 (PDT)
Received: from krug (87-196-72-49.net.novis.pt. [87.196.72.49])
 by smtp.gmail.com with ESMTPSA id
 n16-20020a5d67d0000000b002fae7408544sm21912996wrw.108.2023.05.11.17.51.51
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 11 May 2023 17:51:52 -0700 (PDT)
From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
To: Felician Nemeth <felician.nemeth@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
In-Reply-To: <87h6sla14k.fsf@HIDDEN> (Felician Nemeth's message of
 "Tue, 09 May 2023 19:03:07 +0200")
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN>
 <87v8j7vy48.fsf@HIDDEN> <83r0tuv62t.fsf@HIDDEN>
 <874jp8gu8a.fsf@HIDDEN> <838re3jowg.fsf@HIDDEN>
 <87ttwqsow9.fsf@HIDDEN> <87ttwpbpaj.fsf@HIDDEN>
 <875y93arek.fsf@HIDDEN>
 <CALDnm52V_B7p_Eg-VgzOcTpy206fEb1Z96xs4+5=aT3R3UBsmg@HIDDEN>
 <87h6sla14k.fsf@HIDDEN>
Date: Fri, 12 May 2023 01:54:07 +0100
Message-ID: <871qjm5pzk.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 3.6 (+++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  Felician Nemeth writes: > João Távora writes: > >>> Since
    it advances the status quo, can this be merged? If not, how >>> should we
    proceed? >> >> Haven't looked at it, but I'd say yes. However, Alan Donovan
    >> has repli [...] 
 
 Content analysis details:   (3.6 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (joaotavora[at]gmail.com)
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
  3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
                             [87.196.72.49 listed in zen.spamhaus.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [209.85.128.41 listed in list.dnswl.org]
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
                             [209.85.128.41 listed in wl.mailspike.net]
X-Debbugs-Envelope-To: 62116
Cc: sebastian.poeplau@HIDDEN, adonovan@HIDDEN, 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 2.6 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  Felician Nemeth writes: > João Távora writes: > >>> Since
    it advances the status quo, can this be merged? If not, how >>> should we
    proceed? >> >> Haven't looked at it, but I'd say yes. However, Alan Donovan
    >> has repli [...] 
 
 Content analysis details:   (2.6 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
                             [209.85.128.41 listed in wl.mailspike.net]
  3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
                             [87.196.72.49 listed in zen.spamhaus.org]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [209.85.128.41 listed in list.dnswl.org]
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (joaotavora[at]gmail.com)
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Felician Nemeth <felician.nemeth@HIDDEN> writes:

> Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN> writes:
>
>>> Since it advances the status quo, can this be merged?  If not, how
>>> should we proceed?
>>
>> Haven't looked at it, but I'd say yes.  However, Alan Donovan
>> has replied recently, with a recipe showcasing his particular
>> use case.  I dont' have time to try it right now, but if you
>> could try his recipe/use case with your solution, it would be
>> great.
>
> It requires to patch and recompile gopls, which would be too much effort
> for me, unfortunately.

I've now followed Alan's recipe and played around a bit with this.
Starting from your version, I came up with this simpler patch.

I was about to push it, but let's hear your opinions first (though we
can always push and tweak it later).

Jo=C3=A3o


--=-=-=
Content-Type: text/x-patch; charset=utf-8
Content-Disposition: inline;
 filename=0001-Eglot-support-window-showRequest.patch
Content-Transfer-Encoding: quoted-printable

From 1acbbc188a7c43063f9d6a4d25e3d854052cc956 Mon Sep 17 00:00:00 2001
From: =3D?UTF-8?q?Felici=3DC3=3DA1n=3D20N=3DC3=3DA9meth?=3D <felician.nemet=
h@HIDDEN>
Date: Fri, 12 May 2023 01:50:05 +0100
Subject: [PATCH] Eglot: support window/showRequest (bug#62116)
MIME-Version: 1.0
Content-Type: text/plain; charset=3DUTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN>

* lisp/progmodes/eglot.el (eglot-client-capabilities): Advertise
window/showDocument.
(eglot-handle-request window/showDocument): New handler.
---
 lisp/progmodes/eglot.el | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 66d893a14b5..291ae9b83d9 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -845,7 +845,8 @@ eglot-client-capabilities
                                        `(:valueSet
                                          [,@(mapcar
                                              #'car eglot--tag-faces)])))
-            :window `(:workDoneProgress t)
+            :window `(:showDocument (:support t)
+                      :workDoneProgress t)
             :general (list :positionEncodings ["utf-32" "utf-8" "utf-16"])
             :experimental eglot--{})))
=20
@@ -2366,6 +2367,27 @@ eglot-handle-request
   "Handle server request workspace/workspaceFolders."
   (eglot-workspace-folders server))
=20
+(cl-defmethod eglot-handle-request
+  (_server (_method (eql window/showDocument)) &key
+           uri external takeFocus selection)
+  "Handle request window/showDocument."
+  (if (eq external t) (browse-url uri)
+    (let* (;; requests run with a let-bound `eglot--cached-server',
+           ;; but when finding files from handlers, this fools
+           ;; `eglot--maybe-activate-editing-mode'.
+           (eglot--cached-server nil))
+      (with-current-buffer (find-file-noselect (eglot--uri-to-path uri))
+        (cond (takeFocus
+               (pop-to-buffer (current-buffer))
+               (select-frame-set-input-focus (selected-frame)))
+              ((display-buffer (current-buffer))))
+        (when selection
+          (eglot--widening
+           (pcase-let ((`(,beg . ,end) (eglot--range-region selection)))
+             (goto-char beg)
+             (pulse-momentary-highlight-region beg end 'highlight)))))))
+  '(:success t))
+
 (defun eglot--TextDocumentIdentifier ()
   "Compute TextDocumentIdentifier object for current buffer."
   `(:uri ,(eglot--path-to-uri (or buffer-file-name
--=20
2.39.2


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 11 May 2023 23:10:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 11 19:10:08 2023
Received: from localhost ([127.0.0.1]:53634 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pxFQG-0003J5-3w
	for submit <at> debbugs.gnu.org; Thu, 11 May 2023 19:10:08 -0400
Received: from mail-wm1-f41.google.com ([209.85.128.41]:59508)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@HIDDEN>) id 1pxFQE-0003IQ-9e
 for 62116 <at> debbugs.gnu.org; Thu, 11 May 2023 19:10:06 -0400
Received: by mail-wm1-f41.google.com with SMTP id
 5b1f17b1804b1-3f423ac6e2dso40482185e9.2
 for <62116 <at> debbugs.gnu.org>; Thu, 11 May 2023 16:10:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1683846600; x=1686438600;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=CpmY//Is+VR1RIEfBPnwAGDkwlvIn/NTE59yZnMzZKo=;
 b=WcNFRI4WFQwZRa7VSBVXVCMpig2sqZ/nQ1Ud4dvMrojTVSqrFhDpE/yrcv9QupH9Bi
 HNujY02oSlBpcok9a6v0SDcsctXG4TOysYxMj/a2/Dt8KdBjrGbOy/vcHM25/VvYpkoN
 mXtqmQdyBiNGzNWCI/1n3V7J1cBkeYUMTDj7geDOtl9Q46ghNUJI5e11mm2y/Uhdrtzx
 z9DyXx6EAHw8xO/88GLOmLoYvGAeV5I3CglkNBp1ZzL3PsaMRVvnYOCPZVqjWl6iygqn
 CSR/oONixQ7md+Xe6zTEhqrZ/U2B/NdjPPg+0Qn8p89f54kzbeOpkoW85TPb92gKuFwm
 s0bQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1683846600; x=1686438600;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=CpmY//Is+VR1RIEfBPnwAGDkwlvIn/NTE59yZnMzZKo=;
 b=Ac3Y4Bf8F8rdxiy8FDE0H48qpSawLjAN7k2jWrXW9K79S1w352YowoS+Nu5WUwa0MO
 dLiEKZI2yLTPgGp49rSi16AYJTeaxNzd/uVeY+pVMi0e2Sd+SVry9w2kvghCSg9fVyot
 fDtVEjJfElbzy9amqdpIZYwRikwG1FtbxF3ALCdayVmKp0iSukiY0LmouBoGI66Yy0Sv
 jGWCFLBefEqE4qAstaSdCMIfH/+kTXxOsOX7LE/+U/rQPGMymBQXxXBv8fPERRsYRcU4
 GDeYDkvYfYv/+Xm2XAj0n5Ee9SfJL+NBnb3m3b9kbg788UFjCmEJUuPzMIdZk8bX4Brx
 NRJA==
X-Gm-Message-State: AC+VfDy+2ui+w73b2aDddUYkBXiWbJmlInb/NY5IaFPVq0p9RqvYBdv+
 i9DlRfY+LFlzTdRMIkUuztE=
X-Google-Smtp-Source: ACHHUZ5WpniNuSeh5f0YzfFdJU9gMsKyDpIjQm+eKNwa+OCvbLT+bNBsITID8xwNX20LiEIcZVp8cg==
X-Received: by 2002:adf:de03:0:b0:2f5:7ce1:781d with SMTP id
 b3-20020adfde03000000b002f57ce1781dmr14486742wrm.50.1683846600480; 
 Thu, 11 May 2023 16:10:00 -0700 (PDT)
Received: from krug (87-196-72-49.net.novis.pt. [87.196.72.49])
 by smtp.gmail.com with ESMTPSA id
 u1-20020a5d4681000000b003062f894b64sm21995701wrq.22.2023.05.11.16.09.59
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 11 May 2023 16:09:59 -0700 (PDT)
From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
To: Alan Donovan <adonovan@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
In-Reply-To: <CAPVWWDW0rA7HZYYYC_3jjXtZ+ApPjjUk1q5sPRg-j8_yt27rFQ@HIDDEN>
 (Alan Donovan's message of "Fri, 5 May 2023 13:35:49 -0400")
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN>
 <87v8j7vy48.fsf@HIDDEN> <83r0tuv62t.fsf@HIDDEN>
 <874jp8gu8a.fsf@HIDDEN> <838re3jowg.fsf@HIDDEN>
 <87ttwqsow9.fsf@HIDDEN>
 <CAPVWWDVsh82-BT1B_nRAh9YrvSLGLKzUT+xC3Yt9px+FTU754w@HIDDEN>
 <87pm7esnl0.fsf@HIDDEN>
 <CAPVWWDW0rA7HZYYYC_3jjXtZ+ApPjjUk1q5sPRg-j8_yt27rFQ@HIDDEN>
Date: Fri, 12 May 2023 00:12:13 +0100
Message-ID: <87a5ya5upe.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 3.6 (+++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  Alan Donovan writes: > On Fri, 5 May 2023 at 13:17, João
   Távora 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 [...] 
 
 Content analysis details:   (3.6 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (joaotavora[at]gmail.com)
  3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
                             [87.196.72.49 listed in zen.spamhaus.org]
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
                             [209.85.128.41 listed in wl.mailspike.net]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [209.85.128.41 listed in list.dnswl.org]
X-Debbugs-Envelope-To: 62116
Cc: sebastian.poeplau@HIDDEN, Felician Nemeth <felician.nemeth@HIDDEN>,
 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 2.6 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  Alan Donovan writes: > On Fri, 5 May 2023 at 13:17, João
   Távora 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 [...] 
 
 Content analysis details:   (2.6 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
                             [209.85.128.41 listed in wl.mailspike.net]
  3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
                             [87.196.72.49 listed in zen.spamhaus.org]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [209.85.128.41 listed in list.dnswl.org]
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (joaotavora[at]gmail.com)
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager

Alan Donovan <adonovan@HIDDEN> writes:

> On Fri, 5 May 2023 at 13:17, Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN>=
 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=C3=A1=
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/va=
lidate.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=C3=A1ns patch.  We
can always adjust it later.

Jo=C3=A3o

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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 11 May 2023 22:39:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 11 18:39:48 2023
Received: from localhost ([127.0.0.1]:53623 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pxEwk-0002ES-7y
	for submit <at> debbugs.gnu.org; Thu, 11 May 2023 18:39:48 -0400
Received: from mail-wm1-f44.google.com ([209.85.128.44]:56578)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@HIDDEN>) id 1pxEwi-0002EA-0U
 for 62116 <at> debbugs.gnu.org; Thu, 11 May 2023 18:39:37 -0400
Received: by mail-wm1-f44.google.com with SMTP id
 5b1f17b1804b1-3f42c865535so37194965e9.1
 for <62116 <at> debbugs.gnu.org>; Thu, 11 May 2023 15:39:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1683844770; x=1686436770;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=NuLNO8HXkunDzMzG1DPevfHYbEZN9e8HBXylnDyRB0o=;
 b=dCjKeqachp00O1Jn6cK9BgL+vl1YS8814XOnj0nMv6DY8kBJz3Tyl1Z6u/MGWjf64e
 /5hAGWuFKiNgPq5xDu3zMyb6Nv5PejD9dhq3TsySfeQkpC8pk/ZeXkKTHGHBczkRiAT3
 N60GnkaGsiZGFj1ukXlg/7QngFm8Jxt43iSMN9WjtuArOczUxjldA6pMwstpvXZ0foEX
 WSoopx6ymRwEzUPzUKv1GiNqo54tbclgzQJwXpkzZpVakjRuCpwV17mJ4zuacaf3fj4y
 Hx4G0sdxDQ6EXQcWM5b58Si5GDjmOpOVMZIOGhsZaLCrCKbLdJi09tea7zRf/2XgsA4j
 tg7A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1683844770; x=1686436770;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=NuLNO8HXkunDzMzG1DPevfHYbEZN9e8HBXylnDyRB0o=;
 b=NGoadZ5GFwWN+B9kjEvyqUbeF5D+VlxEcoSsoNEGNbC6CiAeTDFNzU4y2h0+piifnv
 OdaJ20a7mBKvRwBI4fxqrYmLvjZt627ES1Rbj6rL0KcTCOSjMGextJdvauEUyXvK4kPz
 s2S5AJ0Z2E6Jzrb0C/2vWOmDAz4zeluLs8Wkb1E0uJH/ACtpoMSNvsax+H1DS80370wQ
 69bSHFK0KLhnuQloPOMk4asmq1UXKs+axnJnVvZlGKXjKU+RYXRgH2MU4fbW1csjn3b1
 MR84LIOqFr/Gpz/Ukg1TvYQxJD2jEpv1zq9ERr38UYxRMyo5bidqkrXJb9botxiZgRPy
 ws7w==
X-Gm-Message-State: AC+VfDxk7Zta7wD7rEZY3G2kVvWdYgRt9vKmK7vX1XL/nUTIo5g6gDiV
 1wnRU7Kvf5OdsaxWQWW4+eY=
X-Google-Smtp-Source: ACHHUZ62go47WkVKlbXmGHwNDTCADUvjeFqqTAYR5K8yXMqzAub3X/SXFCB6Qp1FgO7l0o8L2mx/Jw==
X-Received: by 2002:a7b:cc05:0:b0:3f1:7581:eaaf with SMTP id
 f5-20020a7bcc05000000b003f17581eaafmr15790313wmh.4.1683844769946; 
 Thu, 11 May 2023 15:39:29 -0700 (PDT)
Received: from krug (87-196-72-49.net.novis.pt. [87.196.72.49])
 by smtp.gmail.com with ESMTPSA id
 f8-20020a7bcd08000000b003f42894ebe2sm11101773wmj.23.2023.05.11.15.39.28
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 11 May 2023 15:39:29 -0700 (PDT)
From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
To: Alan Donovan <adonovan@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
In-Reply-To: <CAPVWWDXMW8q-08104neu6tm+4yvYE26Z1rwRMjSUcXAngAYs1g@HIDDEN>
 (Alan Donovan's message of "Tue, 9 May 2023 13:13:26 -0400")
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN>
 <87v8j7vy48.fsf@HIDDEN> <83r0tuv62t.fsf@HIDDEN>
 <874jp8gu8a.fsf@HIDDEN> <838re3jowg.fsf@HIDDEN>
 <87ttwqsow9.fsf@HIDDEN> <87ttwpbpaj.fsf@HIDDEN>
 <875y93arek.fsf@HIDDEN>
 <CALDnm52V_B7p_Eg-VgzOcTpy206fEb1Z96xs4+5=aT3R3UBsmg@HIDDEN>
 <87h6sla14k.fsf@HIDDEN>
 <CAPVWWDXMW8q-08104neu6tm+4yvYE26Z1rwRMjSUcXAngAYs1g@HIDDEN>
Date: Thu, 11 May 2023 23:41:42 +0100
Message-ID: <87v8gy8p95.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 3.6 (+++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Alan Donovan writes: > On Tue, 9 May 2023 at 13:03, Felician
 Nemeth wrote: >> It requires to patch and recompile gopls, > > FWIW, the
 commands to do that are: > > git clone golang.org/x/tools > cd tools > git
 fetch http [...] 
 Content analysis details:   (3.6 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (joaotavora[at]gmail.com)
 3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
 [87.196.72.49 listed in zen.spamhaus.org]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [209.85.128.44 listed in list.dnswl.org]
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [209.85.128.44 listed in wl.mailspike.net]
X-Debbugs-Envelope-To: 62116
Cc: sebastian.poeplau@HIDDEN, Felician Nemeth <felician.nemeth@HIDDEN>,
 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Alan Donovan <adonovan@HIDDEN> writes:

> On Tue, 9 May 2023 at 13:03, Felician Nemeth <felician.nemeth@HIDDEN> =
wrote:
>> It requires to patch and recompile gopls,
>
> FWIW, the commands to do that are:
>
> git clone golang.org/x/tools
> cd tools
> git fetch https://go.googlesource.com/tools refs/changes/35/474735/3
> && git cherry-pick FETCH_HEAD

FTR, the first command doesn't work, not with my Git at least.  If I add
a https:// in front, then the remote will tell me to fetch from
go.googlesource.com instead.  If I do that and try the cherry-pick, I
get conflicts.

So I'm just using `git checkout FETCH_HEAD` instead and hoping it will
work.

Jo=C3=A3o




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 9 May 2023 17:13:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 09 13:13:47 2023
Received: from localhost ([127.0.0.1]:44393 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pwQuJ-00086R-HP
	for submit <at> debbugs.gnu.org; Tue, 09 May 2023 13:13:47 -0400
Received: from mail-pl1-f175.google.com ([209.85.214.175]:36884)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <adonovan@HIDDEN>) id 1pwQuG-00086A-Gu
 for 62116 <at> debbugs.gnu.org; Tue, 09 May 2023 13:13:46 -0400
Received: by mail-pl1-f175.google.com with SMTP id
 d9443c01a7336-1ac65ab7432so124185ad.0
 for <62116 <at> debbugs.gnu.org>; Tue, 09 May 2023 10:13:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=google.com; s=20221208; t=1683652418; x=1686244418;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=d151RnztWGBC7aNWVL+s4sE0dbGn8cp8WgeY6bLhk3w=;
 b=Gz2F4FxzrBnBJfAlEJ+7RP+P+wVAwQECotmnnzWAmvmNbsCLcdnnHpcOb2eCCqPUNV
 sQsS0+wD5qlaK/4Tk3jsbQPVwU6CZ3FEwXnty4tKiYF019vyiRm/1txBAwvxrnsarAvS
 i4W6IDIc+mebmFxHBBTWpE1MveXb1Lx8K0bryfhMi0uc4gZTBkliICgZ4GqlmT/2kMQ2
 +gJD9070FveY1gjOgRzeHWDSn3uX3QiVLFI4o4RIbsfjU6bZFseeRAWswEc/qMdJ46kP
 FsNbWCiR3X04t07EQBqEAdVUiFi1MzARLQHyR36X3Y1QF+sbNG6SN8AGr34vCg9biyip
 lJfw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1683652418; x=1686244418;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=d151RnztWGBC7aNWVL+s4sE0dbGn8cp8WgeY6bLhk3w=;
 b=dUvKHEI61Dn6UUZB36PboHwJId1vuPUkSD2gns4cgUwBLwrFqknYOZqBXNWXlJsd9n
 MnYQLz+t7CM6xldE00cV84CxfuArq7ToJF6ehmPJxK+ymFSkCqGMUC0/NYtAbgNj1/my
 yrEpQsjSKQX1rNbYoGvNxAtrwSdePQ+GKCtAW5BVgrrBsWDfokBaGvIK22QMorAheB6d
 q/oceis40IOkX9oTEPkqmOoEjScQsVkh1A3eMu6MGEN14os14OBEo8XUIlPxxcVtKCr7
 N+w4v7U5BIc/zTn8CQ0vJEI8ZSgLB0l/eDrVtqNPQqCH2hKx8OpjQjqOXj24g48MPe2D
 qdVw==
X-Gm-Message-State: AC+VfDz9a1F8tTkPlnVyrXz1DqoLUt5x/fUOUjS2DE/jJwv/UecBrKkz
 boTPolhVIMyM8Wa8I+jP9MOv7U7UYqOXJCPOQcu5tw==
X-Google-Smtp-Source: ACHHUZ7zfESUW0kPQAoxD5pZ2zThwZS8c8q7G1cL5CDgLExP2udwbYLo1LTdFxUmCoxCeQvXi+cuFGpNDWZ7VN/+6a8=
X-Received: by 2002:a17:902:e551:b0:198:af50:e4de with SMTP id
 n17-20020a170902e55100b00198af50e4demr93plf.4.1683652418349; Tue, 09 May 2023
 10:13:38 -0700 (PDT)
MIME-Version: 1.0
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN> <87v8j7vy48.fsf@HIDDEN>
 <83r0tuv62t.fsf@HIDDEN> <874jp8gu8a.fsf@HIDDEN>
 <838re3jowg.fsf@HIDDEN> <87ttwqsow9.fsf@HIDDEN>
 <87ttwpbpaj.fsf@HIDDEN>
 <875y93arek.fsf@HIDDEN>
 <CALDnm52V_B7p_Eg-VgzOcTpy206fEb1Z96xs4+5=aT3R3UBsmg@HIDDEN>
 <87h6sla14k.fsf@HIDDEN>
In-Reply-To: <87h6sla14k.fsf@HIDDEN>
From: Alan Donovan <adonovan@HIDDEN>
Date: Tue, 9 May 2023 13:13:26 -0400
Message-ID: <CAPVWWDXMW8q-08104neu6tm+4yvYE26Z1rwRMjSUcXAngAYs1g@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
To: Felician Nemeth <felician.nemeth@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: -8.0 (--------)
X-Debbugs-Envelope-To: 62116
Cc: sebastian.poeplau@HIDDEN,
 =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>, 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -9.0 (---------)

On Tue, 9 May 2023 at 13:03, Felician Nemeth <felician.nemeth@HIDDEN> wrote:
> It requires to patch and recompile gopls,

FWIW, the commands to do that are:

git clone golang.org/x/tools
cd tools
git fetch https://go.googlesource.com/tools refs/changes/35/474735/3
&& git cherry-pick FETCH_HEAD
cd gopls
go install

Hope that helps.

cheers
alan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 9 May 2023 17:03:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 09 13:03:17 2023
Received: from localhost ([127.0.0.1]:44329 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pwQk9-0007lf-9N
	for submit <at> debbugs.gnu.org; Tue, 09 May 2023 13:03:17 -0400
Received: from mail-wr1-f44.google.com ([209.85.221.44]:46296)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <felician.nemeth@HIDDEN>) id 1pwQk7-0007lL-J1
 for 62116 <at> debbugs.gnu.org; Tue, 09 May 2023 13:03:16 -0400
Received: by mail-wr1-f44.google.com with SMTP id
 ffacd0b85a97d-3063afa2372so5654070f8f.0
 for <62116 <at> debbugs.gnu.org>; Tue, 09 May 2023 10:03:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1683651789; x=1686243789;
 h=content-transfer-encoding:mime-version:face:user-agent:message-id
 :in-reply-to:date:references:subject:cc:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=mYAza1N0+YwTTOKCbVrc6yYBquaDmy3tOS83yoKEgig=;
 b=XRnWd3Ms66EyUXPgDZHPhU1j6XXl3S0Gcgs7uiSz+0RlNN1xFodEar9rgRsSL0JvBD
 0Rf2xXWfCtjTakJZOcbih6t/DJGuEvpHm5hRznm8zsw50QHKeZU9peNMgxSt2bEb82l+
 k+K4jlfD1vPZIrX0Ze69wmA/JZ0IjyhucVpT9sAYE9wR9e3+M2KglwR82If0d7zgkjgl
 /iHuOVDqLCmEs6QB+OyorDHmceTfRC4QB+6JdmQniowsSJW5+hrIkwT5qpMRXpJq3L1p
 TbwYpIM4TSY7mz+CW3eHNdNpn9cWxOGOMvWB6DwQwzBWO+n8VTr2vFuGjaM6+C48WePK
 vKDg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1683651789; x=1686243789;
 h=content-transfer-encoding:mime-version:face:user-agent:message-id
 :in-reply-to:date:references:subject:cc:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=mYAza1N0+YwTTOKCbVrc6yYBquaDmy3tOS83yoKEgig=;
 b=TADBRy39EVcFqXJJZF5RXrrc3Je8YGI5glrlqQPpALpycDk325lwLORUNagF7svsT/
 4KONwI2HTD7krAGnkjynwu+ISBgfFh2t87VtOeC/Cujmw3S9Oyf0JQSToKKhBoPQ3XAE
 h2RxzVmzuLyui6dl5/5FKy0cRRMMKmZGPqIess0c9cf7qhaiQ7hsmgZxjK/T12yF+Sa9
 peoNnOfopPcIfhHkrJBQc7VZb7SifnVSqv4VPr/CQa6I2pU9/BEY1PGNokO8kHVepR3p
 TR6WvS92WAen0WSGrTVHD3+s65ZAcUG8Rqm4z4E/+5VEvMrh0feKCivzG534zUg2feR2
 GexA==
X-Gm-Message-State: AC+VfDxUiCaFovTX0qIFcos6U8lWynLmypJAGP0egDuyraAN0zocpx9w
 fwoLAymWKbwOxOHU6vMnaiA=
X-Google-Smtp-Source: ACHHUZ4d62E5867BzvQ2+xx90gWDmvOR33FUZesJS8AwPGF3o7+KDtrfZ6RLCQye0x8iY76rpAGLpQ==
X-Received: by 2002:adf:edc6:0:b0:306:337e:4b28 with SMTP id
 v6-20020adfedc6000000b00306337e4b28mr11022321wro.3.1683651789257; 
 Tue, 09 May 2023 10:03:09 -0700 (PDT)
Received: from betli.gmail.com (catv-89-134-210-182.catv.fixed.vodafone.hu.
 [89.134.210.182]) by smtp.gmail.com with ESMTPSA id
 s7-20020a1cf207000000b003f1733feb3dsm20376136wmc.0.2023.05.09.10.03.07
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 09 May 2023 10:03:08 -0700 (PDT)
From: Felician Nemeth <felician.nemeth@HIDDEN>
To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN>
 <87v8j7vy48.fsf@HIDDEN> <83r0tuv62t.fsf@HIDDEN>
 <874jp8gu8a.fsf@HIDDEN> <838re3jowg.fsf@HIDDEN>
 <87ttwqsow9.fsf@HIDDEN> <87ttwpbpaj.fsf@HIDDEN>
 <875y93arek.fsf@HIDDEN>
 <CALDnm52V_B7p_Eg-VgzOcTpy206fEb1Z96xs4+5=aT3R3UBsmg@HIDDEN>
Date: Tue, 09 May 2023 19:03:07 +0200
In-Reply-To: <CALDnm52V_B7p_Eg-VgzOcTpy206fEb1Z96xs4+5=aT3R3UBsmg@HIDDEN>
 (=?utf-8?Q?=22Jo=C3=A3o_T=C3=A1vora=22's?= message of "Mon, 8 May 2023
 17:36:43 +0100")
Message-ID: <87h6sla14k.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEUMBwgHAgMFAAGPjY7/
 //80MDHq6eqJt3pKAAABr0lEQVQ4jX2UzZKDIAzHqR177q7TPbtx2HMr6guQcrbY9txZ0fd/hA0f
 onXazcEJ/CD8E4Js8/HS9mwjXtqeMRxHXJkakTEm4b4GPVQW8PU8ov4fQCqeThlF60MBWdo1IXzd
 2nEEZE7CEAZLwI0N/gJAhTj7ESQAX4gPgO8lyI+cvgViSVPlNomAj2M9gW40eg7VWY3cATjUcyiO
 Z+i03cFruGLYoUR7VyU3HihdmCEVhoDN65FXkpbSxkomOzsTQN/gySaodGb9Gdi1oSRXP46gdBWh
 LcUKJNdeGCWac74GKakmne0aHCFvyqJPYLsCFAVlhRTvGdzMdLHqtgRyUulyXIAH7CYQ3AB0Nody
 JQhAkq/qtOnbjhxdzYDkXPxlH5y4WdUAeUcX1NVJ6GR7UQEYPGWoAnA36OQNn5lRRp38vHTAp9Br
 LoTmvlPPDoRCKzpjG1SXT89AaT5l456BamJuMcs+NIOMzJ/s5dI6yUVcrARlruwOebfdv6gunTn4
 ww3+QjGBEn5suVyLHoSGvAqREuDLN+iqZ+VcFg+HBbsJUU9+FZthbez9T+bdb+kPv2Ls6ct3hTkA
 AAAASUVORK5CYII=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62116
Cc: sebastian.poeplau@HIDDEN, adonovan@HIDDEN, 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN> writes:

>> Since it advances the status quo, can this be merged?  If not, how
>> should we proceed?
>
> Haven't looked at it, but I'd say yes.  However, Alan Donovan
> has replied recently, with a recipe showcasing his particular
> use case.  I dont' have time to try it right now, but if you
> could try his recipe/use case with your solution, it would be
> great.

It requires to patch and recompile gopls, which would be too much effort
for me, unfortunately.

> One note that I didn't yet reply to is that IMO (likely in Alan's
> opinion too), it does make sense to raise the frame.  The
> showDocument may indeed come from somewhere else which is not
> Emacs at all.  I used to work with Common Lisp IDEs like that
> allowed the application being developed to issue requests to
> the editor and pop it up to the user.  It was extremely convenient.

I've looked into this.  The docstring of x-focus-frame says "If there is
no window system support, this function does nothing."  However, this
command

    emacs -Q -nw --eval "(x-focus-frame nil)"

errors out instead of doing nothing.  But supporting the frame raising
feature is approximately as simple as

    (let ((frame (window-frame (get-buffer-window buf t))))
      (raise-frame frame)
      (x-focus-frame frame))

However, I don't work with multiple frames, so I don't know whether the
all-frames parameter of the get-buffer-window should really be t.  I
hope the latest patch can be merged as is, and someone with more
experience with multiple frames can later step in and provide an
additional patch for this extra feature.

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 8 May 2023 16:37:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 08 12:37:01 2023
Received: from localhost ([127.0.0.1]:41459 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pw3rA-0005GV-MW
	for submit <at> debbugs.gnu.org; Mon, 08 May 2023 12:37:00 -0400
Received: from mail-oo1-f43.google.com ([209.85.161.43]:49491)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@HIDDEN>) id 1pw3r9-0005GI-Dr
 for 62116 <at> debbugs.gnu.org; Mon, 08 May 2023 12:36:59 -0400
Received: by mail-oo1-f43.google.com with SMTP id
 006d021491bc7-546ee6030e5so2389784eaf.3
 for <62116 <at> debbugs.gnu.org>; Mon, 08 May 2023 09:36:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1683563814; x=1686155814;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=+JiKMihkHJCn04d9s6i0nV55HOWdq2LjaDSjZ7ruTJM=;
 b=AE+IzwGHu+mfO9Mb1Agm6Xz6l1j74gV9/CBgeXiAPiY94rQlKEARYQ7jGHcdqHfflb
 tuuMsnbXpQ9LNy1PeQWUI65gTX/Ymzp9UiDDF+8KD2haT/0z/JR3l9Qc1t0DNUIBLTvY
 nH/uFjizeEKmHcLSlnZSc9m4djDy+pkgAq+ZllNjv11zXQLKPByOWgJMp5xjM9W1n9cw
 7M7lXbo+NWC8hURyJ+pGZudluCfHseOS1eiIt8HCE8CMCyuRjwBCxIjYeR+1lBalkfeX
 tzze8Yfgcyl6etnPNsvFWhXkt+ZkhuHLIjkODpttUieVk5A0e/Yo84oXjH6mQUmoxWHU
 XeNw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1683563814; x=1686155814;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=+JiKMihkHJCn04d9s6i0nV55HOWdq2LjaDSjZ7ruTJM=;
 b=O74haJaESLrc5iAGgFdDGVEZ7JEzr8Y1QouzSjkIOWSf831mue0h/LdjQJ2L78apUE
 P7dj6DiEBCzPHBdWHRJbGMqVbp69K6YPvcbHjRQnk0PDhuFkV+74uWAfTWpfTYK8Y/dn
 KGYHx8UfxiGuy9/7OdXSuSZvBbyRdTrvdX1SjBonqNocvQxx8bW0rQTiGSj8VmphrVW4
 cLnFr/R2/5Si3owwEu9cURMsSo3RhzifdoP2Yc89/teki7eRzOsqalD1j3UJqxFxkqiX
 3bX10Fp0d67oUnwLJbcl8P3H7T+Acd/0KxcQEecpHyeGzAwbZ7whS2vl1GBd4pxDrq/S
 T97w==
X-Gm-Message-State: AC+VfDy5mOdjIQEVktZX0B42UQpk6yzxbMcYCsmYuScobb4yKlyaAmv1
 oYvRnSocmaH8ZwXOn1VxbqWjvGl/6bb5rr2ZLPWS4g7K
X-Google-Smtp-Source: ACHHUZ5j8obZEHdaQvbX3Lc35aDUboXGzz7XBtTG6iY9vVv4adBZYINVG9IYp8X5A9DkkQ1jFe7kDUkOhLhz2WY+3QY=
X-Received: by 2002:a05:6808:8c4:b0:38e:b9b:a85c with SMTP id
 k4-20020a05680808c400b0038e0b9ba85cmr4994423oij.53.1683563813863; Mon, 08 May
 2023 09:36:53 -0700 (PDT)
MIME-Version: 1.0
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN> <87v8j7vy48.fsf@HIDDEN>
 <83r0tuv62t.fsf@HIDDEN> <874jp8gu8a.fsf@HIDDEN>
 <838re3jowg.fsf@HIDDEN> <87ttwqsow9.fsf@HIDDEN>
 <87ttwpbpaj.fsf@HIDDEN>
 <875y93arek.fsf@HIDDEN>
In-Reply-To: <875y93arek.fsf@HIDDEN>
From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Date: Mon, 8 May 2023 17:36:43 +0100
Message-ID: <CALDnm52V_B7p_Eg-VgzOcTpy206fEb1Z96xs4+5=aT3R3UBsmg@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
To: Felician Nemeth <felician.nemeth@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62116
Cc: sebastian.poeplau@HIDDEN, adonovan@HIDDEN, 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Mon, May 8, 2023 at 2:23=E2=80=AFPM Felician Nemeth
<felician.nemeth@HIDDEN> wrote:
>
> Felician Nemeth <felician.nemeth@HIDDEN> writes:
>
> > If I understand it correctly, you argued that if takeFocus is false,
> > Eglot should still show the requested file, but the point should remain
> > were it was.  I think you're right, but I haven't updated my patch yet.
>
> It is enough to call display-buffer.  I've attached the new patch and a
> simple test that can be run with "emacs -Q -l test.el".
>
> Since it advances the status quo, can this be merged?  If not, how
> should we proceed?

Haven't looked at it, but I'd say yes.  However, Alan Donovan
has replied recently, with a recipe showcasing his particular
use case.  I dont' have time to try it right now, but if you
could try his recipe/use case with your solution, it would be
great.

One note that I didn't yet reply to is that IMO (likely in Alan's
opinion too), it does make sense to raise the frame.  The
showDocument may indeed come from somewhere else which is not
Emacs at all.  I used to work with Common Lisp IDEs like that
allowed the application being developed to issue requests to
the editor and pop it up to the user.  It was extremely convenient.


Jo=C3=A3o




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 8 May 2023 13:23:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 08 09:23:25 2023
Received: from localhost ([127.0.0.1]:39592 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pw0po-0004s6-Tb
	for submit <at> debbugs.gnu.org; Mon, 08 May 2023 09:23:25 -0400
Received: from mail-wm1-f47.google.com ([209.85.128.47]:52376)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <felician.nemeth@HIDDEN>) id 1pw0pn-0004rq-8m
 for 62116 <at> debbugs.gnu.org; Mon, 08 May 2023 09:23:23 -0400
Received: by mail-wm1-f47.google.com with SMTP id
 5b1f17b1804b1-3f415a90215so25946735e9.0
 for <62116 <at> debbugs.gnu.org>; Mon, 08 May 2023 06:23:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1683552197; x=1686144197;
 h=mime-version:face:user-agent:message-id:in-reply-to:date:references
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=Mvpsc22Mvajl6CBgVCxBPp0dFxrouX1icKoNZF0NQbU=;
 b=fq8mwPx74XapWZi/meoXkBS4SkY2PX1chuQz3mVB4tK51fM9jDy629ODYDtl2KkVdJ
 76heTEdU3HMO/RkrGYFphap2gY+ZiI/j9RHjGRDrGy5LfzQpdqb1bxQklti3avlRoz2S
 BAp9l6a52VPUnwqEPZnb0Ro2okNpH2ANQ+pp2DkGy914hvkW8zIALgzOr5RF1+Ugp8QU
 miyW9n8BV4TWeDOlQ0uaNGTygFmdxQtYjbjuDYDYa0lACcflB1dAjrljlyQt+Und8QpO
 YNt3qkjAwZu0gPz6d0bHiNnyajDKp9TZIwrTBwen6smkVXeMHv98xT/Toixkxsf+Bfl0
 lZ3A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1683552197; x=1686144197;
 h=mime-version:face:user-agent:message-id:in-reply-to:date:references
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=Mvpsc22Mvajl6CBgVCxBPp0dFxrouX1icKoNZF0NQbU=;
 b=K/druW3uvbQhAX/42+7SlOJzQEKi+6PM1Zs9YEV07qasoEWByJOn2AB5wIdTQLmG5h
 WmJDJoT3gwjdpChKCNgg1GsMeDJnfyD76Ju1Kt2sc9oAm+ZAwLfm0TjexKFW8FDf3eWA
 gn7D4BvMOG+nMh4/eV5SOp7+WNk5xP8dKzrXbzJgzqeKTmkANFHbFB7UPZsOuJuZdbNl
 yj4qNzQwUpai4xIbVpt1j3XtQAscaRZRbsAW8LK0PsPkjqWJAWiFegJOB+6tUuUqNFbF
 gRFvcBOfacKOWi4ue1Y8qG0i+7CLqzIVOtP5/PxTipDypEioiGNgCa4o/8gApaYt0y8K
 8VZQ==
X-Gm-Message-State: AC+VfDyKLxfRqXZ2I/LbFhtLb9MWbrdCfxgvaMrlCWO97YAbKEl/GNsB
 PNW5l6CbXU45aoPLc+J4NGE=
X-Google-Smtp-Source: ACHHUZ6UndisJPXvjWmawfF9a77weOMoqJiVWXwNQnBj/DIzRJRxqUW4Kf0BXVMHiFfmkNUZBWRH/A==
X-Received: by 2002:a05:600c:c5:b0:3f4:2610:5cd0 with SMTP id
 u5-20020a05600c00c500b003f426105cd0mr1700627wmm.7.1683552197172; 
 Mon, 08 May 2023 06:23:17 -0700 (PDT)
Received: from betli.gmail.com (catv-89-134-210-182.catv.fixed.vodafone.hu.
 [89.134.210.182]) by smtp.gmail.com with ESMTPSA id
 z9-20020a05600c114900b003f4069417absm13963568wmz.24.2023.05.08.06.23.16
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 08 May 2023 06:23:16 -0700 (PDT)
From: Felician Nemeth <felician.nemeth@HIDDEN>
To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN>
 <87v8j7vy48.fsf@HIDDEN> <83r0tuv62t.fsf@HIDDEN>
 <874jp8gu8a.fsf@HIDDEN> <838re3jowg.fsf@HIDDEN>
 <87ttwqsow9.fsf@HIDDEN> <87ttwpbpaj.fsf@HIDDEN>
Date: Mon, 08 May 2023 15:23:15 +0200
In-Reply-To: <87ttwpbpaj.fsf@HIDDEN> (Felician Nemeth's message of
 "Sat, 06 May 2023 14:46:44 +0200")
Message-ID: <875y93arek.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEWOdXElERN7LDLZs6/l
 0dDQq6TepMcqAAACW0lEQVQ4jWWSzY7bMAyEaSm6mypylxjkroTRvUW8d9lavf+r7NDOZotWQHzg
 lyGHP0Sn5ed9qKrLWWIWos9/QJWIeCSywPNTd/AE0LtwFj7A+3WT5PwfeBrQKcsBnkfwVcNySWQr
 3i34XN6gRNgis/v4uwSKHCD9lPitB0Aq9BHfHX4cgsI7cJJfLdZg/4bbCzoRmkD9MsagQSBDedZi
 CgNxkVSJmSOStTBUBKkywEnEoZzbwWj+ACiVJkF6pOpak2PMCqkMYDpaw+gatLR8atMOrB3JGzmm
 3rSQo+tkxU+UAbhQSgtslULhsXKk6+IyQ1QTzeQB0MzjlpkCEUCeUdviWrwBcxVqpZjP+v0MYPA0
 aq2rvIEZe4GRM0v+9QIB03rsABVSk5y+Mz3LSzExtJLlCCO6dV1uzDQFTBad+gO0TqqL9XE8x4ek
 +orvYiMJgzC8e+r6TqaPaK6QyqVNvoHtsRrooQ6tTi4vgaSkd8wIikodB3B0iIk58avsDdYNajpS
 bSKJ+mQnipGszB6zW4lGgsOkKHE2RWVcBpwhaIv3BYIAu3WsnC7YYKLRchp6w8fRGZIWiZuFsVai
 7gbcUcJEhiDZ3K1+uzZvBlfaEO8oH4MLu6/hrKVM7QpQcIXJFuC1XjfbfKRxNslk94l9cYcEihV2
 HWyNDQAXaLsvnrSyp7HaQhrAn13V6/XW11nh0XINBOEAV+tHK4EvAGNGvEwc0eZw8Vyr56imYEsV
 sOW9jxm/yb9AH1ufqGMviIK7A0Tc/723oM3tJ4HTOu9gDr3ftbdkxfdjsUv5AqWKwyfCYo5WAAAA
 AElFTkSuQmCC
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62116
Cc: sebastian.poeplau@HIDDEN, adonovan@HIDDEN, 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

Felician Nemeth <felician.nemeth@HIDDEN> writes:

> If I understand it correctly, you argued that if takeFocus is false,
> Eglot should still show the requested file, but the point should remain
> were it was.  I think you're right, but I haven't updated my patch yet.

It is enough to call display-buffer.  I've attached the new patch and a
simple test that can be run with "emacs -Q -l test.el".

Since it advances the status quo, can this be merged?  If not, how
should we proceed?

Thanks.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Eglot-support-window-showDocument-request.patch

From 468a8104183ba46f92d0a194862761c81943c505 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felici=C3=A1n=20N=C3=A9meth?= <felician.nemeth@HIDDEN>
Date: Sat, 22 Apr 2023 10:49:17 +0200
Subject: [PATCH] Eglot: support window/showDocument request

* eglot.el (eglot-client-capabilities): Add showDocument support.
(eglot-handle-request window/showDocument): New cl-defmethod.
---
 lisp/progmodes/eglot.el | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 3134d55fc0..daabb4ff7b 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -830,7 +830,8 @@ eglot-client-capabilities
                                        `(:valueSet
                                          [,@(mapcar
                                              #'car eglot--tag-faces)])))
-            :window `(:workDoneProgress t)
+            :window `(:showDocument (:support t)
+                      :workDoneProgress t)
             :general (list :positionEncodings ["utf-32" "utf-8" "utf-16"])
             :experimental eglot--{})))
 
@@ -2345,6 +2346,28 @@ eglot-handle-request
   "Handle server request workspace/workspaceFolders."
   (eglot-workspace-folders server))
 
+(cl-defmethod eglot-handle-request
+  (_server (_method (eql window/showDocument)) &key
+           uri external takeFocus selection)
+  "Handle request window/showDocument."
+  (if (eq external t)
+      (browse-url uri)
+    (let ((filename (eglot--uri-to-path uri)))
+      (if (eq takeFocus t)
+          (find-file filename)
+        (display-buffer (find-file-noselect filename)))
+      (when selection
+        (with-current-buffer (get-file-buffer filename)
+          (save-restriction
+            (widen)
+            (pcase-let ((`(,beg . ,end) (eglot--range-region selection)))
+              (if (equal beg end)
+                  (goto-char beg)
+                (goto-char end)
+                (set-mark-command nil)
+                (goto-char beg))))))))
+  '(:success t))
+
 (defun eglot--TextDocumentIdentifier ()
   "Compute TextDocumentIdentifier object for current buffer."
   `(:uri ,(eglot--path-to-uri (or buffer-file-name
-- 
2.30.2


--=-=-=
Content-Type: application/x-gtar-compressed
Content-Disposition: attachment; filename=test-showDucument-ada.tgz
Content-Transfer-Encoding: base64

H4sIAAAAAAAAA+2XS4/aMBCAOfMrrBxKkGpK0jwOnCqtKvVQaQ89cvHGA7g1NvKD3Z/fcQK7sIVl
DxHbbv0dSHDG4/GMx/Y4sI7alb6/8Y1fg3KUcfZp0CtTpC7L8Mzqcnr43DPIiiKvsjrPq3owzcos
Kwak7NeM03jrmCFkoGANbrU4K3fp+z+KOxn/NRNqwvhdP2OEAFdFcT7+ed3GvyyysqwrjH+FC2BA
pv0M/zL/efw3RjfAvQHyHWNOhCXKSzl7a7MiV+J0/ofWCciexriQ/9nnquz2f3zN8yLkfzEtY/5f
g2HKYeEVYdJS7VZg6EJIIOkHvXFCKyaJBbMFMx4SkgrlwLDGiS20/2EptaPwAI13QBu9XjPFSarN
rtNegjbemLC2umaqDZXawjgoOUNybFByXjLdQuP001g/4MHd6G4xf+P4IxYC7UeG+8m2i75hUlLJ
XDDzYI7GK3ov3IoKLoE6scbvOVFCktEzH+06BbWMc7rS+hcZdUY0Wim0atf2bLjQwSsJ1pIUrWmC
nzeonTO61rzzLNopFFAOBn3N23ayFyC4Zy+7t+QLZ0nbIVjgNJXCOlTl8TUIUNY1pMl8jue5nc9H
CZk8ahq/vuvdH12P571vP3IDKIsnSxDE2fDOa8nubmHR7uFsRr5q07RTatAhQi0JOphsdPBYt55a
jR9J6/h7YYEc6iZcgw1qFH7H3pNhuvF2RUYSFo54ZYDxR0WwxdVgcdi3Trq/iNP7/2QpXH9FwGvv
/2Vdl3kW9v8yiMf7/xU4HX9Mx5+4f02WG9PDGBfv/1X+dP8PclgHYhkYz/8rcNtFmtzi1b89Yxd4
lLalgMetNt3v1nfJeDYEPNxvY2nwrnix/rf9jHEx/7OD+h/3glD/YxkQ8/8KHNf/MbkjkUgkEolE
IpFIJBKJRCKR98RvyqPSQAAoAAA=
--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 6 May 2023 12:46:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 06 08:46:56 2023
Received: from localhost ([127.0.0.1]:59626 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pvHJP-00074r-K5
	for submit <at> debbugs.gnu.org; Sat, 06 May 2023 08:46:56 -0400
Received: from mail-wr1-f49.google.com ([209.85.221.49]:54501)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <felician.nemeth@HIDDEN>) id 1pvHJM-00074e-OW
 for 62116 <at> debbugs.gnu.org; Sat, 06 May 2023 08:46:54 -0400
Received: by mail-wr1-f49.google.com with SMTP id
 ffacd0b85a97d-3062db220a3so1831598f8f.0
 for <62116 <at> debbugs.gnu.org>; Sat, 06 May 2023 05:46:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1683377206; x=1685969206;
 h=mime-version:face:user-agent:message-id:in-reply-to:date:references
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=Cnx+ol+197s/2aFgMz82nKEWzvNC3AHUa9tcrqVRk1U=;
 b=U04SAZ2I50Ok+O8xaezEoG6sMHSsTRTMMNHsyN5edWCfamCEdJ02HCA+IsGvQ6hHEi
 OSxq5Mb5i+aliIg2Rl2xjwqZvAKHhBmKvRWyxvlO89r/EGhTkG+9djuhPYwrfxlydHUk
 TO6p345YgBzoU+QzoLQhb6v5A83v+Si9kTZhg6dodjIh19ZnOm40sXcwyD3ANxWzZEIU
 LNBjT8vl12HFD750EqJzT+Aqa/0TEfPzbzqsK3vGPRyWjb3veZShj9v721Rxmz3Bvh0h
 byFxIXniYzTWIp2ucsEk4p5yKw1P4AxPM45azIU+QPJIplngAFzaIhkWPMEkjrWzPEtq
 zSNA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1683377206; x=1685969206;
 h=mime-version:face:user-agent:message-id:in-reply-to:date:references
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=Cnx+ol+197s/2aFgMz82nKEWzvNC3AHUa9tcrqVRk1U=;
 b=RhpkzGNjwPTxHEY/tEqsG/n/gVzVHZBB+x40EW+wpyxcT+dzuVUPcXW2YaIg939Q+z
 G0o7glxuHz1/wk0wgJ0gdpbBM9jG80/DOKkOOnce4rcNvmbisgutH5Ou++q/PR1epFwx
 pmuVVG4CGC+89jQKXV3UInZu/w0P6d85KY0k8XGhMMryOkOX8WBu05uo4CXhq6RC0HSd
 wB7hStrf2OZK11DxK8HHIKnFxtc8HFWaRbTNm+SjNlVX+luWq+xdy8wEPwXuJwlmR8Jn
 HgWh1hE2UBjjIdaYo6OfZ9qeo+AW3cwYU9AC3302qV6G7OvhXunjXgSAdPR9SuFxheaX
 xgHw==
X-Gm-Message-State: AC+VfDzjHCkxTTCfjD29o2TupDxrl9aZHmRnc6WETmZebuoSvVoddEo+
 P5bVZpvBljo+Bbhyrw4wV9q0bwzkAPrKYg==
X-Google-Smtp-Source: ACHHUZ5Fzq1lB45PKwxwHr0sGerixpMyG+xPgX8NVJD0Yc8R7aocbRGW2nPnjwSl9J+Jx/42qTiKAg==
X-Received: by 2002:adf:e6ca:0:b0:2fa:631a:9f38 with SMTP id
 y10-20020adfe6ca000000b002fa631a9f38mr3652737wrm.2.1683377206119; 
 Sat, 06 May 2023 05:46:46 -0700 (PDT)
Received: from betli.gmail.com (catv-89-134-210-182.catv.fixed.vodafone.hu.
 [89.134.210.182]) by smtp.gmail.com with ESMTPSA id
 v12-20020a5d678c000000b00304a876c3c1sm5363596wru.5.2023.05.06.05.46.45
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 06 May 2023 05:46:45 -0700 (PDT)
From: Felician Nemeth <felician.nemeth@HIDDEN>
To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN>
 <87v8j7vy48.fsf@HIDDEN> <83r0tuv62t.fsf@HIDDEN>
 <874jp8gu8a.fsf@HIDDEN> <838re3jowg.fsf@HIDDEN>
 <87ttwqsow9.fsf@HIDDEN>
Date: Sat, 06 May 2023 14:46:44 +0200
In-Reply-To: <87ttwqsow9.fsf@HIDDEN> (=?utf-8?Q?=22Jo=C3=A3o_T=C3=A1vor?=
 =?utf-8?Q?a=22's?= message of "Fri, 05 May 2023 17:51:02 +0100")
Message-ID: <87ttwpbpaj.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEWOdXElERN7LDLZs6/l
 0dDQq6TepMcqAAACW0lEQVQ4jWWSzY7bMAyEaSm6mypylxjkroTRvUW8d9lavf+r7NDOZotWQHzg
 lyGHP0Sn5ed9qKrLWWIWos9/QJWIeCSywPNTd/AE0LtwFj7A+3WT5PwfeBrQKcsBnkfwVcNySWQr
 3i34XN6gRNgis/v4uwSKHCD9lPitB0Aq9BHfHX4cgsI7cJJfLdZg/4bbCzoRmkD9MsagQSBDedZi
 CgNxkVSJmSOStTBUBKkywEnEoZzbwWj+ACiVJkF6pOpak2PMCqkMYDpaw+gatLR8atMOrB3JGzmm
 3rSQo+tkxU+UAbhQSgtslULhsXKk6+IyQ1QTzeQB0MzjlpkCEUCeUdviWrwBcxVqpZjP+v0MYPA0
 aq2rvIEZe4GRM0v+9QIB03rsABVSk5y+Mz3LSzExtJLlCCO6dV1uzDQFTBad+gO0TqqL9XE8x4ek
 +orvYiMJgzC8e+r6TqaPaK6QyqVNvoHtsRrooQ6tTi4vgaSkd8wIikodB3B0iIk58avsDdYNajpS
 bSKJ+mQnipGszB6zW4lGgsOkKHE2RWVcBpwhaIv3BYIAu3WsnC7YYKLRchp6w8fRGZIWiZuFsVai
 7gbcUcJEhiDZ3K1+uzZvBlfaEO8oH4MLu6/hrKVM7QpQcIXJFuC1XjfbfKRxNslk94l9cYcEihV2
 HWyNDQAXaLsvnrSyp7HaQhrAn13V6/XW11nh0XINBOEAV+tHK4EvAGNGvEwc0eZw8Vyr56imYEsV
 sOW9jxm/yb9AH1ufqGMviIK7A0Tc/723oM3tJ4HTOu9gDr3ftbdkxfdjsUv5AqWKwyfCYo5WAAAA
 AElFTkSuQmCC
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62116
Cc: 62116 <at> debbugs.gnu.org, adonovan@HIDDEN, sebastian.poeplau@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=iso-8859-2
Content-Transfer-Encoding: quoted-printable

> Felici=E1n, can you show your full patch again, perhaps with a unit test
> using the ada language server?

I've attached the patch.

However, I failed to write a unit test.  At the end of
eglot-handle-request buffer-name shows the expected main.adb, but at the
end of the my ert-deftest it is the old, incorrect value.  This puzzles
my, because if I interactively repeat the test steps, everything is OK.
I copy the test code at the end of the email.

> Also, can you comment on why you think Alan Donovan's patch has that
> non-synchronous find-file mechanism?  Since Alan, doesn't reply, what do
> you conjecture is the reason his patch goes through this trouble?
>
> I'd also like someone to address my comments of that patch, which is
> similar to yours:
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D62116#10.  Among others
>
> 1. if you think the Emacs frame should be raised and/or focused when a
>    window.showDocument comes in.

I always use Emacs in single frame, so I have no experience in this
area, but I don't understand why x-focus-frame is necessary.  The
showDocument request should not come out of the blue, and if the user is
actively working on a source file, the frame is already in focus.

> 2. if browse-url should be used for non-file: urls (it might open a
>    browser window outside of Emacs, which IMO is fine.)

My original patch used browse-url as well.  browse-url is highly
customizable, and I think it is right thing to use here.  Users can
customize it to relay the URL to eww, firefox, etc even for specific
URLs.

If I understand it correctly, you argued that if takeFocus is false,
Eglot should still show the requested file, but the point should remain
were it was.  I think you're right, but I haven't updated my patch yet.

Alan's patch also contains a recenter call, which I think is unnecessary
and would probably annoy me, when the target point was already visible
before the showDocument request.

On the other hand, if the showDocument request contains a selection,
both patches could be enhanced to better visualize this selection.

Because of the timers, Alan's eglot-handle-request returns success even
if the inner lambda fails.  It should probably check if filename exists
before calling run-with-idle-timer.

However, I don't like approach of using timers.  I think a better
alterative is to put a modified lambda function in an event queue, and
Eglot should process the queue after it sent its reply to the client
request.

Finally, I think Alan's copyright status is still unclear.

And this is the my failed attempt at writing a test:

(ert-deftest eglot-test-window/showDocument ()
  "Test handling a window/showDocument server request."
  (skip-unless (executable-find "ada_language_server"))
  (let (server)
    (eglot--with-fixture
     '(("project" .
        (("project.gpr" .
          "Project P is\n   for Main use (\"main.adb\");\nend P;")
         ("main.ads" . "procedure Main;")
         ("main.adb" . "procedure Main is null;"))))
     (with-current-buffer
         (eglot--find-file-noselect "project/main.ads")
       (eglot--sniffing (:server-requests s-requests
                         :server-replies s-replies
                         :client-requests c-requests
                         :client-replies c-replies)
         (should (setq server (eglot--tests-connect)))
         (eglot-execute-command server "als-other-file"
                                (vector (eglot--TextDocumentIdentifier)))
         (let (cmd-id show-doc-id)
           (eglot--wait-for (c-requests 2)
               (&key id method &allow-other-keys)
               (setq cmd-id id)
               (string=3D method "workspace/executeCommand"))
           (eglot--wait-for (s-requests 2)
               (&key id method &allow-other-keys)
             (setq show-doc-id id)
             (string=3D method "window/showDocument"))
           (eglot--wait-for (c-replies 1)
               (&key id error &allow-other-keys)
               (and (eq id show-doc-id) (null error)))
           (eglot--wait-for (s-replies 1)
               (&key id &allow-other-keys)
               (eq id cmd-id))))
         (should (string-equal (buffer-name) "main.adb"))))))


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Eglot-support-window-showDocument-request.patch

From 468a8104183ba46f92d0a194862761c81943c505 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felici=C3=A1n=20N=C3=A9meth?= <felician.nemeth@HIDDEN>
Date: Sat, 22 Apr 2023 10:49:17 +0200
Subject: [PATCH] Eglot: support window/showDocument request

* eglot.el (eglot-client-capabilities): Add showDocument support.
(eglot-handle-request window/showDocument): New cl-defmethod.
---
 lisp/progmodes/eglot.el | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 3134d55fc0..daabb4ff7b 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -830,7 +830,8 @@ eglot-client-capabilities
                                        `(:valueSet
                                          [,@(mapcar
                                              #'car eglot--tag-faces)])))
-            :window `(:workDoneProgress t)
+            :window `(:showDocument (:support t)
+                      :workDoneProgress t)
             :general (list :positionEncodings ["utf-32" "utf-8" "utf-16"])
             :experimental eglot--{})))
 
@@ -2345,6 +2346,28 @@ eglot-handle-request
   "Handle server request workspace/workspaceFolders."
   (eglot-workspace-folders server))
 
+(cl-defmethod eglot-handle-request
+  (_server (_method (eql window/showDocument)) &key
+           uri external takeFocus selection)
+  "Handle request window/showDocument."
+  (if (eq external t)
+      (browse-url uri)
+    (let ((filename (eglot--uri-to-path uri)))
+      (if (eq takeFocus t)
+          (find-file filename)
+        (find-file-noselect filename))
+      (when selection
+        (with-current-buffer (get-file-buffer filename)
+          (save-restriction
+            (widen)
+            (pcase-let ((`(,beg . ,end) (eglot--range-region selection)))
+              (if (equal beg end)
+                  (goto-char beg)
+                (goto-char end)
+                (set-mark-command nil)
+                (goto-char beg))))))))
+  '(:success t))
+
 (defun eglot--TextDocumentIdentifier ()
   "Compute TextDocumentIdentifier object for current buffer."
   `(:uri ,(eglot--path-to-uri (or buffer-file-name
-- 
2.30.2


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 5 May 2023 17:37:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 05 13:37:11 2023
Received: from localhost ([127.0.0.1]:57380 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1puzMl-0007aN-L7
	for submit <at> debbugs.gnu.org; Fri, 05 May 2023 13:37:11 -0400
Received: from mail-pl1-f175.google.com ([209.85.214.175]:35892)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <adonovan@HIDDEN>) id 1puzMj-0007a8-Ko
 for 62116 <at> debbugs.gnu.org; Fri, 05 May 2023 13:37:10 -0400
Received: by mail-pl1-f175.google.com with SMTP id
 d9443c01a7336-1a950b982d4so613415ad.0
 for <62116 <at> debbugs.gnu.org>; Fri, 05 May 2023 10:37:09 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=google.com; s=20221208; t=1683308224; x=1685900224;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=eQxwNTR/cCrLuppehfCQCnKQstVnoBBsEXQLHb1JupA=;
 b=VkW+Ohkt5MHpE5OJu28kqKmrwS8Uun/igV8Oo7u9hvTqtSmdTK1NRtSEJy+4vamECN
 brav30uy+rrjG0JZhbOk2QiAoTb+NLSTq+hprw09i232cofBSXGxEMMI0MaavoP5XJ6G
 ibr9nuP6lU+7Dyh54o8FbfdlNXxWZDo+2DRVWW8ELn6KwAwDzFe4hXH6wsGxnBW+RlRy
 q488FM+L0siJurIazsQSWTMfQQjjDJDjFCoFynd95NGt6FaNGRvDihFelmyRc0k6ARSG
 Q/tdtRXpj0i/omk5JE2jlS2qOIEiIycMsIrCBhM6OU1ZQkcB3CwkOa82VMT150aSx9az
 SWFQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1683308224; x=1685900224;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=eQxwNTR/cCrLuppehfCQCnKQstVnoBBsEXQLHb1JupA=;
 b=GMb2BocvxtSRcda07MlKN64lIfaqOOOPRf0dwaD5APk6Dx/wAPut114plL0m9w4Dgu
 nGc11zsU+uwqZPprxewxlJPGwF/tN7/gf3lbVpfEZI3lOfdAbk/GFZpytaU2v8TejWvp
 4PIXBnHgYTVT3H3D4OripSoETjix0xwI34+7F4SAIZB3M5ssQRZArRIWo2k6y4jiEmp9
 62y6siS+ZwiNOu55RheYUSCNEn2t02EvV5BJOMmrnLKE1jrkJYmvccgLdmUkNFxUy6fy
 nqveo6rkA88KBYeR2gUZsMznhPOxil+ZXSHL0H8gyupimfV3P9ZgqDsucoBrZstLSJXo
 FHQg==
X-Gm-Message-State: AC+VfDyzyaHwiG2Bi32ojFHDFw7CvebfgujIE5mFthm6fynTHVvSijNr
 MtvOZ2CkqoU8YfYVW69pArWazyb/OhSkNbTXvCMaXA==
X-Google-Smtp-Source: ACHHUZ4XK6jc30wKyvT96P10aRUUyVkS+7GUmrLrvaXVz76xgQBFVXIo3PaI3fbI4dWRbftj7sjgVBvsrPCTTzQI7CQ=
X-Received: by 2002:a17:902:d506:b0:1ac:32ac:f4c with SMTP id
 b6-20020a170902d50600b001ac32ac0f4cmr7678plg.10.1683308223955; Fri, 05 May
 2023 10:37:03 -0700 (PDT)
MIME-Version: 1.0
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN> <87v8j7vy48.fsf@HIDDEN>
 <83r0tuv62t.fsf@HIDDEN> <874jp8gu8a.fsf@HIDDEN>
 <838re3jowg.fsf@HIDDEN> <87ttwqsow9.fsf@HIDDEN>
 <CAPVWWDVsh82-BT1B_nRAh9YrvSLGLKzUT+xC3Yt9px+FTU754w@HIDDEN>
 <87pm7esnl0.fsf@HIDDEN>
 <CAPVWWDW0rA7HZYYYC_3jjXtZ+ApPjjUk1q5sPRg-j8_yt27rFQ@HIDDEN>
In-Reply-To: <CAPVWWDW0rA7HZYYYC_3jjXtZ+ApPjjUk1q5sPRg-j8_yt27rFQ@HIDDEN>
From: Alan Donovan <adonovan@HIDDEN>
Date: Fri, 5 May 2023 13:36:52 -0400
Message-ID: <CAPVWWDXYJxs11a0GYb9R3VmSGs4PCndxq3JJ6MY9v32ddjY=Xw@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: -8.0 (--------)
X-Debbugs-Envelope-To: 62116
Cc: sebastian.poeplau@HIDDEN, Felician Nemeth <felician.nemeth@HIDDEN>,
 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -9.0 (---------)

> 2. Download and checkout this commit:
> https://go-review.git.corp.google.com/c/tools/+/474735

Sorry, that's https://go.dev/cl/474735 for folks outside our network.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 5 May 2023 17:36:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 05 13:36:10 2023
Received: from localhost ([127.0.0.1]:57376 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1puzLm-0007YY-55
	for submit <at> debbugs.gnu.org; Fri, 05 May 2023 13:36:10 -0400
Received: from mail-pl1-f182.google.com ([209.85.214.182]:37335)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <adonovan@HIDDEN>) id 1puzLi-0007Xz-H4
 for 62116 <at> debbugs.gnu.org; Fri, 05 May 2023 13:36:09 -0400
Received: by mail-pl1-f182.google.com with SMTP id
 d9443c01a7336-1aae90f5ebcso610655ad.1
 for <62116 <at> debbugs.gnu.org>; Fri, 05 May 2023 10:36:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=google.com; s=20221208; t=1683308161; x=1685900161;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=9LKXfXZKS6XfHWVol50zRC0ePR/XTxKdKmAlfazSwDA=;
 b=UW+SVOOI+XA5+4TJ1hlVdjMJdWiUNrlaHlE9T2x4tFRPrKuVkRG9lQFdeh0eZCFCEZ
 oE5pMFoDmPXLlKy1CCZTcV1Rj5IF7UQWgP6Lee8NAo7pB5Khm56sPDNAM0vQcfWaH0QZ
 DD8jfaYVDJDnaa0cwPoVMH4v82uMHsgUPR9dVokhSymJ+nopzluEXbbSAR8ehx/xwvut
 q8QvtgtheUBd+msighjaUNoktNbVgVgvORN/NBx29HW1bZiAANWIbogqk7aWZuQKOAJh
 cuVdp2av4X5tMZ2j35HCbla4cIet1STzJm3bSFNRJl0+4rz59rceqJ1w4xIb5pVrlMM1
 iBFA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1683308161; x=1685900161;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=9LKXfXZKS6XfHWVol50zRC0ePR/XTxKdKmAlfazSwDA=;
 b=d+hDdxldVPUIbdHklwiEGOssVdTV3kXo3EtLiI+PKGstLpERFCkWg3/PtSIEQ1LAIc
 X84S1+K0nHgRtklpmx7mMqBugtMWN+OXM2zONdcyOKGSbxgkizftKUW8s6rhhBZJdjJm
 pwmXpTRIP2SJAZVwrDousZXbNFTS3uRYHZt5e/HHIOMy+K+3dSfdaIi/Mqi719IcbXMp
 2ZU5IPAS/OQYgQve0FmfkYdj3LPPZqhcpIL5oEZgX6yXxtBD7pJNUb11V3vyLin5es1G
 GvOD5Sud83Ib03u2LsHXWkMM7hUU7ojtMIXY8PUZofydY5LDbwDafFmyFFFClnJnTshk
 9qnw==
X-Gm-Message-State: AC+VfDzWWNd8cuXhz4jg0AOeZ2rOL3AxFuhkI+Pre1qItQwNOihjse7j
 7vjTp996gnPqSwyzReyAvovZGG2arT8zklaHu3Efsw==
X-Google-Smtp-Source: ACHHUZ72fcIJ/khdyC0dkTPwh+HqjomQc5AiRAE2HBUYRdjoeFDB7fuxY7KFBLcpMwc7eG4A/80y0aYR9ttVkPNyAqM=
X-Received: by 2002:a17:903:32c6:b0:1a6:b0e4:e102 with SMTP id
 i6-20020a17090332c600b001a6b0e4e102mr13663plr.18.1683308160560; Fri, 05 May
 2023 10:36:00 -0700 (PDT)
MIME-Version: 1.0
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN> <87v8j7vy48.fsf@HIDDEN>
 <83r0tuv62t.fsf@HIDDEN> <874jp8gu8a.fsf@HIDDEN>
 <838re3jowg.fsf@HIDDEN> <87ttwqsow9.fsf@HIDDEN>
 <CAPVWWDVsh82-BT1B_nRAh9YrvSLGLKzUT+xC3Yt9px+FTU754w@HIDDEN>
 <87pm7esnl0.fsf@HIDDEN>
In-Reply-To: <87pm7esnl0.fsf@HIDDEN>
From: Alan Donovan <adonovan@HIDDEN>
Date: Fri, 5 May 2023 13:35:49 -0400
Message-ID: <CAPVWWDW0rA7HZYYYC_3jjXtZ+ApPjjUk1q5sPRg-j8_yt27rFQ@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -8.0 (--------)
X-Debbugs-Envelope-To: 62116
Cc: sebastian.poeplau@HIDDEN, Felician Nemeth <felician.nemeth@HIDDEN>,
 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -9.0 (---------)

On Fri, 5 May 2023 at 13:17, Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN> w=
rote:
> 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:

1. git clone golang.org/x/tools

2. Download and checkout this commit:
https://go-review.git.corp.google.com/c/tools/+/474735
(It's a stack of 2 messy CLs on top of an old master, but it works.)

3. (cd gopls && go install)
This puts gopls on your $PATH.

4. killall gopls
So that eglot uses the new executable.

5. Load the definition of the eglot-handle-request window/showDocument hand=
ler.

6. Also load this function.
(defun gopls--package-docs ()
  "Open the documentation for this Go package in a browser."
  (interactive)
  (save-excursion
    ;; TODO(adonovan): We currently cram this functionality into the
    ;; textDocument/definition RPC applied to the "package" keyword.
    ;; Do something more principled.
    (goto-char 0)
    (re-search-forward "^package ")
    (beginning-of-line)
    (xref-find-definitions 'package)))

7. Visit a Go file, e.g. go/analysis/analysis.go. Move cursor to the
"package" keyword.

8. Run the gopls--package-docs command. This sends an "definitions"
RPC request for the package keyword. The server has been modified to
interpret this as a (strange) request to open a web page of package
documentation. The server sends a showDocument request
(http://localhost...) to the client. The client handler
eglot-handle-request opens a browser. You should see a page full of
links to source declarations.

9. Click on one of these links. This causes the web server (gopls) to
send another showDocument request, this time for file://..., to the
client, which causes gopls to open the file containing the declaration
and move to the correct position.

Removing the asynchrony causes the file:// downcall to get stuck
because it makes an upcall to gopls while the server is still waiting
for the showDocument downcall to finish.





> 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)

See above.

> >> 2. if browse-url should be used for non-file: urls (it might open a br=
owser 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.

I think "file:" URLs should be opened by find-file in Emacs, and all
other URLs should go to browse-url (and thence Chrome, etc).

cheers
alan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 5 May 2023 17:17:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 05 13:17:20 2023
Received: from localhost ([127.0.0.1]:57354 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1puz3X-00073O-Oo
	for submit <at> debbugs.gnu.org; Fri, 05 May 2023 13:17:20 -0400
Received: from mail-wm1-f49.google.com ([209.85.128.49]:62812)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@HIDDEN>) id 1puz3V-000738-4W
 for 62116 <at> debbugs.gnu.org; Fri, 05 May 2023 13:17:18 -0400
Received: by mail-wm1-f49.google.com with SMTP id
 5b1f17b1804b1-3f315735514so107022495e9.1
 for <62116 <at> debbugs.gnu.org>; Fri, 05 May 2023 10:17:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1683307031; x=1685899031;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=yi9OBPzFFPXPzN8+rebtPl4POljeqJTTDGDLspNmUZs=;
 b=MAVmopuaVJukQh3JXENwpJ6RibMYun1Hh0NCLLPK07S7vPfVnRb1GIve/OxkL/ewk8
 bMGo48tq7IQod2bLg9xkyi5KfU+ZBN1uOo6QFYpOsBV5dL+vb6elYivWAr0c7QUYOClR
 bqXt6yd8tBhdTXJ3+zgVbPgsgg52S5lxXP4dixtMWBNnPEkN9kw9D4f5be5iEF0tq9OP
 IE85TDQOB0dIAD34OhL9S3K0Ji3eZ4DdGAi5GkmWDGIsy5ynGl0GwI5hW67UhNDVYzZt
 qcHA0VxBqwAGMEmljsAdRjLSU2PLeHwCf6UKpYVYJ+3/GSd93uDZyK7BD+HS/KOXvf/J
 wwxg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1683307031; x=1685899031;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=yi9OBPzFFPXPzN8+rebtPl4POljeqJTTDGDLspNmUZs=;
 b=HsNdd2tp2f8EEzqKJI5xPTheLW9rqDoMNbN5hQk3JBMlTjL8J59zo/aG+6F0bm706n
 Jtsp6TNbEMdoQCkCpvJgf87bxSQESe9hnpiCZ5cMXGjKF9bBt1RPtAasE2U/mZGVleNA
 +IEqFldQ6oxYTch+rx8ucKLppkTtHt0Y3X0ZF6HJeIGKoLvfr/D/bqTiNbJaIbMeTum4
 pUOrF2yi+5w68PjO47weO7X7cAI8BEIBDcAUShxzcreADewSzot6FZZn+ijvkGfqVUFK
 NZntLMY7fh60U6fUui3an87Duh/2aWGddAHqVBwaGs8Vo+fAzG/KyC1OM+BX+GW7Cg9Q
 FAfg==
X-Gm-Message-State: AC+VfDxAlInReU44b69hDmGlNpQi/KiVkz0zmM1EJT4w2LfjjY8jqRsv
 QV6EZZaOWrpPMHEA3LUWH20=
X-Google-Smtp-Source: ACHHUZ6R56U8njUinnfN9I997YIJhLT0LAMzw+6CyR652RBJDsWPeOI53gbIKxfvQ9c6FHP867PV4g==
X-Received: by 2002:a1c:f719:0:b0:3f1:70d5:1be8 with SMTP id
 v25-20020a1cf719000000b003f170d51be8mr2121186wmh.15.1683307031065; 
 Fri, 05 May 2023 10:17:11 -0700 (PDT)
Received: from krug (87-196-74-197.net.novis.pt. [87.196.74.197])
 by smtp.gmail.com with ESMTPSA id
 b13-20020a05600010cd00b00306299be5a2sm2968337wrx.72.2023.05.05.10.17.09
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 05 May 2023 10:17:10 -0700 (PDT)
From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
To: Alan Donovan <adonovan@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
In-Reply-To: <CAPVWWDVsh82-BT1B_nRAh9YrvSLGLKzUT+xC3Yt9px+FTU754w@HIDDEN>
 (Alan Donovan's message of "Fri, 5 May 2023 13:06:58 -0400")
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN>
 <87v8j7vy48.fsf@HIDDEN> <83r0tuv62t.fsf@HIDDEN>
 <874jp8gu8a.fsf@HIDDEN> <838re3jowg.fsf@HIDDEN>
 <87ttwqsow9.fsf@HIDDEN>
 <CAPVWWDVsh82-BT1B_nRAh9YrvSLGLKzUT+xC3Yt9px+FTU754w@HIDDEN>
Date: Fri, 05 May 2023 18:19:23 +0100
Message-ID: <87pm7esnl0.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62116
Cc: sebastian.poeplau@HIDDEN, Felician Nemeth <felician.nemeth@HIDDEN>,
 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Alan Donovan <adonovan@HIDDEN> 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 -- t=
hat
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 w=
indow.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 brow=
ser 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=C3=A3o





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 5 May 2023 17:07:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 05 13:07:19 2023
Received: from localhost ([127.0.0.1]:57344 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1puytr-0006nI-35
	for submit <at> debbugs.gnu.org; Fri, 05 May 2023 13:07:19 -0400
Received: from mail-pl1-f177.google.com ([209.85.214.177]:37314)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <adonovan@HIDDEN>) id 1puyto-0006mz-DI
 for 62116 <at> debbugs.gnu.org; Fri, 05 May 2023 13:07:17 -0400
Received: by mail-pl1-f177.google.com with SMTP id
 d9443c01a7336-1aae90f5ebcso605385ad.1
 for <62116 <at> debbugs.gnu.org>; Fri, 05 May 2023 10:07:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=google.com; s=20221208; t=1683306430; x=1685898430;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=Ncyw176dHXXiAXbHcHbJnw66HoYD/SxLwkp9GVPbuiY=;
 b=NMMHA5LfyfApR4DrZKqkE9+onUROEgQ82w7pWyh1LsK7FlMgdyWLL/XWvY0IA6f2iz
 nC6+jiGq+eQiRjpI9z0GOxzuooXPIVBB4znxHAZkVm1QYfhKI9lWB5bQotfI/cbsC3W8
 Wh7Sb4qDRSc6cWe2k+X2FnwYi7Qw6YYATHNYkATB/fMHusIm8p0K+aHq5/YXp/pt+7GL
 6KRVnN0NC3hzdr5Ua/AovLufJ9kdvdEnEHxZatX0EWQRh+Yf1UJVnLmrazASd78Rwd/k
 dMfFsmJAIcyetEJsKV2+yGw+NUOzKBSS69+K114aUxy6II7NuLBQcIzNIXa18f3hXXee
 Kbew==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1683306430; x=1685898430;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=Ncyw176dHXXiAXbHcHbJnw66HoYD/SxLwkp9GVPbuiY=;
 b=fUu2fIITjYwkudO2Ttnv1yo+C1Tx/9oKjqzEPp4C9FUJL9+eQ7qf4yghT4P/7WXjID
 DxHgWX+XxbVia+G0YOsag11DoCSNVOpUXGHYuvLY38Y9zY812iya1OssPD/CmXobwACg
 H6GrbMmcTruugeiXcSAEpHXRfGV80im7bbJyYijTKDGWlLvJYgzHB0BMEm6twP5KDCcf
 Ry4ZzCuW1184z/yDzcfM1HnrZLJ55McX2ZmXVp5zsbebgNmrg/aVsqKjc5Zm9Hyevr+X
 DruemdC/dyxf4onQCZ2ymDw78jS31oawEDfk15N/T3XTvdaMDhfFnbKm/jZ2zaM3XJG8
 4L7A==
X-Gm-Message-State: AC+VfDxVG9EbVUhQFXUAOGgh/vPmiyURJIF2dMvJvNq8J6kmDAdvi2Lf
 BUKv+8BJkpr7oBvlQg51uPAJEd6xgtEMruYGmU/7CQ==
X-Google-Smtp-Source: ACHHUZ52ne8a9YkcA544Td1cPVSc6GDysyQa8du/1FD70V4SiZX9seCd5tonWihrGYuyXgm7ByMa7X3qnjmbUlTCT4s=
X-Received: by 2002:a17:902:d487:b0:1a9:7cbf:a7c1 with SMTP id
 c7-20020a170902d48700b001a97cbfa7c1mr205944plg.13.1683306430395; Fri, 05 May
 2023 10:07:10 -0700 (PDT)
MIME-Version: 1.0
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN> <87v8j7vy48.fsf@HIDDEN>
 <83r0tuv62t.fsf@HIDDEN> <874jp8gu8a.fsf@HIDDEN>
 <838re3jowg.fsf@HIDDEN> <87ttwqsow9.fsf@HIDDEN>
In-Reply-To: <87ttwqsow9.fsf@HIDDEN>
From: Alan Donovan <adonovan@HIDDEN>
Date: Fri, 5 May 2023 13:06:58 -0400
Message-ID: <CAPVWWDVsh82-BT1B_nRAh9YrvSLGLKzUT+xC3Yt9px+FTU754w@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -8.0 (--------)
X-Debbugs-Envelope-To: 62116
Cc: sebastian.poeplau@HIDDEN, Felician Nemeth <felician.nemeth@HIDDEN>,
 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -9.0 (---------)

On Fri, 5 May 2023 at 12:48, Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN> w=
rote:
> Also, can you comment on why you think Alan Donovan's patch has that
> non-synchronous find-file mechanism?  Since Alan, doesn't reply, what do
> you conjecture is the reason his patch goes through this trouble?

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

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.

> 1. if you think the Emacs frame should be raised and/or focused when a wi=
ndow.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.

> 2. if browse-url should be used for non-file: urls (it might open a brows=
er 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.

cheers
alan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 5 May 2023 16:48:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 05 12:48:57 2023
Received: from localhost ([127.0.0.1]:57330 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1puyc5-0006Aj-G6
	for submit <at> debbugs.gnu.org; Fri, 05 May 2023 12:48:57 -0400
Received: from mail-wr1-f47.google.com ([209.85.221.47]:54543)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@HIDDEN>) id 1puyc3-0006AU-Ht
 for 62116 <at> debbugs.gnu.org; Fri, 05 May 2023 12:48:56 -0400
Received: by mail-wr1-f47.google.com with SMTP id
 ffacd0b85a97d-30639daee76so1405266f8f.1
 for <62116 <at> debbugs.gnu.org>; Fri, 05 May 2023 09:48:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1683305330; x=1685897330;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=fI/WblfkfkjvqepvF28mJVVIIMqeEHdYXSZlC8qvXHY=;
 b=KQ8FBNRrKYEVygwbUK3CExY6E+xTWR2EnXI55ff8SNlnkFwtrr2XGrwkWoZTqJ7Tf6
 hOLm82oDRp3HEV/OX+VVZOKFZO/phFnMD0ag9j/WL/MFyWdO4jwD3+y2GcNAdR+09lC2
 BZf4jk3t5cTotALh5CKiY1Yy1HXowQq6v+Y2qpKa6neL5TJJ1mq5q588MllL2kA4kn9L
 PQ+sfT8gdq6SxM/Xr8ibSHRM27459YeBFabh5AVmmmwEleeA2MDkaFFVWfNYjQ7mIQ7V
 7yoQDDY0zA4ObjZtLsjZ1+36tmbYOSImkH5SHliAR8inLfmgwqlC09WbTk5CICraJ4Zl
 x1OA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1683305330; x=1685897330;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=fI/WblfkfkjvqepvF28mJVVIIMqeEHdYXSZlC8qvXHY=;
 b=FsBc1XHqnIZ4uLOljGTMkZcI3/d/s6FT9AUOrbToxGDm6vTEWMhr+uth/4+Dr2BdMw
 Kz+wwUpY4HKeXZQ6fXo3iVM8NqbbrrTfMXntfg9CnKb3bUO/OCAvPHhmGPyEfOB5PdFc
 sSjLqS7Ugf9wriPzh20uT5KTIjzskLpJ3y+Op0N71Nh5xMUP2UEyBsN5TncYFih6t5Xj
 vFZgRFfy6A2qEGcDc2f98tfR6SJ8kXenbvIe7n+sax6JNIs7pnB5eHShNCPKXMD0vovb
 KMP9FlVTfarqZ20sz98UUQnTuktBqg7SXy6ES/5eazxyxZGx1yaeUkeNREhqUdKB1bmz
 ourA==
X-Gm-Message-State: AC+VfDxy/0ERbCshrBLka2dVVw1TOCIWkWlVgyzLG5T0bNNxK6kkGAEg
 u+49VW13op5pqEcExcpZowE=
X-Google-Smtp-Source: ACHHUZ6DitTx4sGxDycm3ccZYg9KtAEins420KCUY4Sg4UA24sT4jh6WnF0aS/tfOZGUwofZWK5/Yg==
X-Received: by 2002:a5d:5404:0:b0:305:ed26:8576 with SMTP id
 g4-20020a5d5404000000b00305ed268576mr1662808wrv.9.1683305329622; 
 Fri, 05 May 2023 09:48:49 -0700 (PDT)
Received: from krug (87-196-74-197.net.novis.pt. [87.196.74.197])
 by smtp.gmail.com with ESMTPSA id
 l8-20020a5d4bc8000000b0030631f199f9sm2853605wrt.34.2023.05.05.09.48.48
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 05 May 2023 09:48:49 -0700 (PDT)
From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
To: Felician Nemeth <felician.nemeth@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
In-Reply-To: <838re3jowg.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 05 May
 2023 09:03:27 +0300")
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN>
 <87v8j7vy48.fsf@HIDDEN> <83r0tuv62t.fsf@HIDDEN>
 <874jp8gu8a.fsf@HIDDEN> <838re3jowg.fsf@HIDDEN>
Date: Fri, 05 May 2023 17:51:02 +0100
Message-ID: <87ttwqsow9.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62116
Cc: sebastian.poeplau@HIDDEN, adonovan@HIDDEN, 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Felician Nemeth <felician.nemeth@HIDDEN>
>> Cc: Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN>,
>>   adonovan@HIDDEN, Eli Zaretskii
>>  <eliz@HIDDEN>, Sebastian Poeplau <sebastian.poeplau@HIDDEN>
>> Date: Sat, 22 Apr 2023 11:08:05 +0200
>>=20
>> This is a continuation of the thread=20
>>   https://lists.gnu.org/archive/html/emacs-devel/2023-04/msg00206.html
>> , where Jo=C3=A3o suggested we should proceed with my simpler patch unti=
l we
>> hear from Alan.  This message summarizes the current situation:
>>   https://lists.gnu.org/archive/html/emacs-devel/2023-04/msg00339.html
>>=20
>> I tested my patch with Sebastian's ada example.

Felici=C3=A1n, can you show your full patch again, perhaps with a unit test
using the ada language server?

Also, can you comment on why you think Alan Donovan's patch has that
non-synchronous find-file mechanism?  Since Alan, doesn't reply, what do
you conjecture is the reason his patch goes through this trouble?

I'd also like someone to address my comments of that patch, which is
similar to yours:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D62116#10.  Among others

1. if you think the Emacs frame should be raised and/or focused when a
   window.showDocument comes in.

2. if browse-url should be used for non-file: urls (it might open a
   browser window outside of Emacs, which IMO is fine.)

Jo=C3=A3o




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 5 May 2023 07:35:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 05 03:35:29 2023
Received: from localhost ([127.0.0.1]:53092 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pupyT-0004CL-Fw
	for submit <at> debbugs.gnu.org; Fri, 05 May 2023 03:35:29 -0400
Received: from mail-oi1-f181.google.com ([209.85.167.181]:54524)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@HIDDEN>) id 1pupyP-0004C3-Oe
 for 62116 <at> debbugs.gnu.org; Fri, 05 May 2023 03:35:27 -0400
Received: by mail-oi1-f181.google.com with SMTP id
 5614622812f47-38eb2984c82so490772b6e.0
 for <62116 <at> debbugs.gnu.org>; Fri, 05 May 2023 00:35:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1683272120; x=1685864120;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=GG9sitaasx6POOv80Wrboqd8DkbU+4C+J6hGKUgg9RU=;
 b=Hty+bXvHluyMzXvYezpjNXrQi/omNY+blfPjmSn5vb4SS+D0Pi1s/1med+D3ZSlBtK
 o9OUXiujAaeokLQCs1mQZFdcxlSi4tRK2/zhe5vLCd1XSSnYbI6cTnSx1mvfPez6hNo5
 YXHXLiqlcL+0GTXstYpXpFkqQRhdYfnLheU7C5iFwHq1YQ+z4ighV2PGGj3v/jSrurL6
 nla8YpyJtkZpPjPXktZjHy4y2vGGF9ip+PL1rOXgq1U6DwVcNEfWwUu91yu5SomEPWv/
 /XOFnrki9bpzr/D5TKArU9LIOXrTCIUHwCpYSOHmMNWS1eM5V4PABhoK/CSbt5uPsoMp
 6Y3A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1683272120; x=1685864120;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=GG9sitaasx6POOv80Wrboqd8DkbU+4C+J6hGKUgg9RU=;
 b=OnbEmCjIwsWcVaXLGeWEc0NAfkSZKHei7J6SHxSbybsEjQ8iux/16br/sjlB7TkDMv
 4fw7KTw9AcXSb90wPy8499QYbevmth10b8cr5yGVST8KLSJa5+58CHxFFsX9TrhA2R99
 iO388rimJYDGVCNqtYThP0K6tqS+Oty/jf7cpTWtTsqFd89rGuk+X9MZkqj8+ifWS7oi
 Xn9R6wHzZOCz7yI5iWw2RfLozgQP440nyVxi4vo+Q4ZilHzIpYnFUX9y1BwG+GtmB+qj
 j+Ueq4OahYwBQ2qxlqI//fbOnSCdV49VqLbduv0U2ybaqXyNQsIujSnlcj1dhPSTEhup
 MDsg==
X-Gm-Message-State: AC+VfDyDl9PXK9PsHs2Y2zeoJaX06Eh1aHuwrnUVXQqxaMY+HYUxNAot
 f1ZymyWc7/URd/m8Hhcg5hVJD1sOjjd5jfrr+7A=
X-Google-Smtp-Source: ACHHUZ41B3DUePtus7XrmQVGEfNayCWIconRIhOc25AkPONpBVJKQQBThQYJHuJL1Srn0grHLPLhbyanMWSH6f+hPR8=
X-Received: by 2002:aca:90e:0:b0:38d:f794:25b with SMTP id
 14-20020aca090e000000b0038df794025bmr104933oij.44.1683272119844; 
 Fri, 05 May 2023 00:35:19 -0700 (PDT)
MIME-Version: 1.0
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN> <87v8j7vy48.fsf@HIDDEN>
 <83r0tuv62t.fsf@HIDDEN> <874jp8gu8a.fsf@HIDDEN>
 <838re3jowg.fsf@HIDDEN>
In-Reply-To: <838re3jowg.fsf@HIDDEN>
From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Date: Fri, 5 May 2023 08:35:07 +0100
Message-ID: <CALDnm53-evj7gwU0TqammpPT09k+bvw+os9O0M+ndzFrEOMUzg@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000c3840f05faed54c0"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62116
Cc: Sebastian Poeplau <sebastian.poeplau@HIDDEN>,
 Felician Nemeth <felician.nemeth@HIDDEN>,
 Alan Donovan <adonovan@HIDDEN>, 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--000000000000c3840f05faed54c0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Sorry, I've been busier lately. I'm still very much interested in this
feature, but i would like to test it myself, and ideally in more than one
server.

Jo=C3=A3o

On Fri, May 5, 2023, 07:02 Eli Zaretskii <eliz@HIDDEN> wrote:

> > From: Felician Nemeth <felician.nemeth@HIDDEN>
> > Cc: Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN>,
> >   adonovan@HIDDEN, Eli Zaretskii
> >  <eliz@HIDDEN>, Sebastian Poeplau <sebastian.poeplau@HIDDEN>
> > Date: Sat, 22 Apr 2023 11:08:05 +0200
> >
> > This is a continuation of the thread
> >   https://lists.gnu.org/archive/html/emacs-devel/2023-04/msg00206.html
> > , where Jo=C3=A3o suggested we should proceed with my simpler patch unt=
il we
> > hear from Alan.  This message summarizes the current situation:
> >   https://lists.gnu.org/archive/html/emacs-devel/2023-04/msg00339.html
> >
> > I tested my patch with Sebastian's ada example.
>
> Jo=C3=A3o, any comments?  This discussion seems to have stalled.
>

--000000000000c3840f05faed54c0
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">Sorry, I&#39;ve been busier lately. I&#39;m still very mu=
ch interested in this feature, but i would like to test it myself, and idea=
lly in more than one server.<div dir=3D"auto"><br></div><div dir=3D"auto">J=
o=C3=A3o</div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=
=3D"gmail_attr">On Fri, May 5, 2023, 07:02 Eli Zaretskii &lt;<a href=3D"mai=
lto:eliz@HIDDEN">eliz@HIDDEN</a>&gt; wrote:<br></div><blockquote class=3D=
"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding=
-left:1ex">&gt; From: Felician Nemeth &lt;<a href=3D"mailto:felician.nemeth=
@gmail.com" target=3D"_blank" rel=3D"noreferrer">felician.nemeth@HIDDEN<=
/a>&gt;<br>
&gt; Cc: Jo=C3=A3o T=C3=A1vora &lt;<a href=3D"mailto:joaotavora@HIDDEN" =
target=3D"_blank" rel=3D"noreferrer">joaotavora@HIDDEN</a>&gt;,<br>
&gt;=C2=A0 =C2=A0<a href=3D"mailto:adonovan@HIDDEN" target=3D"_blank" r=
el=3D"noreferrer">adonovan@HIDDEN</a>, Eli Zaretskii<br>
&gt;=C2=A0 &lt;<a href=3D"mailto:eliz@HIDDEN" target=3D"_blank" rel=3D"nor=
eferrer">eliz@HIDDEN</a>&gt;, Sebastian Poeplau &lt;<a href=3D"mailto:seba=
stian.poeplau@HIDDEN" target=3D"_blank" rel=3D"noreferrer">sebastian.p=
oeplau@HIDDEN</a>&gt;<br>
&gt; Date: Sat, 22 Apr 2023 11:08:05 +0200<br>
&gt; <br>
&gt; This is a continuation of the thread <br>
&gt;=C2=A0 =C2=A0<a href=3D"https://lists.gnu.org/archive/html/emacs-devel/=
2023-04/msg00206.html" rel=3D"noreferrer noreferrer" target=3D"_blank">http=
s://lists.gnu.org/archive/html/emacs-devel/2023-04/msg00206.html</a><br>
&gt; , where Jo=C3=A3o suggested we should proceed with my simpler patch un=
til we<br>
&gt; hear from Alan.=C2=A0 This message summarizes the current situation:<b=
r>
&gt;=C2=A0 =C2=A0<a href=3D"https://lists.gnu.org/archive/html/emacs-devel/=
2023-04/msg00339.html" rel=3D"noreferrer noreferrer" target=3D"_blank">http=
s://lists.gnu.org/archive/html/emacs-devel/2023-04/msg00339.html</a><br>
&gt; <br>
&gt; I tested my patch with Sebastian&#39;s ada example.<br>
<br>
Jo=C3=A3o, any comments?=C2=A0 This discussion seems to have stalled.<br>
</blockquote></div>

--000000000000c3840f05faed54c0--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 5 May 2023 06:02:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 05 02:02:42 2023
Received: from localhost ([127.0.0.1]:52951 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1puoWg-0006tf-Cv
	for submit <at> debbugs.gnu.org; Fri, 05 May 2023 02:02:42 -0400
Received: from eggs.gnu.org ([209.51.188.92]:57228)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1puoWe-0006tP-Dz
 for 62116 <at> debbugs.gnu.org; Fri, 05 May 2023 02:02:40 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1puoWZ-0003K9-3C; Fri, 05 May 2023 02:02:35 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=YXhxgJ2RCiov99p8UsVq9ZxA4hkTt/UyX4oeuBjbZKI=; b=DXMu29VDeNLpIDtdI4Xc
 OSGiZAuL6QWs/Dangrb82GqUkfvDLtT5lTDOVj91Rzmn+VlPf4KJkmzJVk+y/uYlprF5p0UAXFqfc
 hPuv3O9SEEFs6rMbYDj68tDWxzFX/z9avMJLqTkkK6fYNAobTNzA2g/wQNUlao1PQflEi1xoxOyLF
 RPDJJSMYoBrSMxF4pVJ87GyF+qMUfFROiEdqGTQZJZuC5nIVZPLi2n9oKVAjd1OdLzl76xoKIbFjy
 1bpg9h+VJ/WltQvXDcDvoEWmh8P3oxercXiXCf8YdMbzUL762cl8z0W73SpjsU7rUPRojkeJJXsad
 Q4moiOp10HhTcA==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1puoWY-0001hv-GP; Fri, 05 May 2023 02:02:34 -0400
Date: Fri, 05 May 2023 09:03:27 +0300
Message-Id: <838re3jowg.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Felician Nemeth <felician.nemeth@HIDDEN>,
 =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
In-Reply-To: <874jp8gu8a.fsf@HIDDEN> (message from Felician Nemeth
 on Sat, 22 Apr 2023 11:08:05 +0200)
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN>
 <87v8j7vy48.fsf@HIDDEN> <83r0tuv62t.fsf@HIDDEN>
 <874jp8gu8a.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62116
Cc: sebastian.poeplau@HIDDEN, adonovan@HIDDEN, 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Felician Nemeth <felician.nemeth@HIDDEN>
> Cc: João Távora <joaotavora@HIDDEN>,
>   adonovan@HIDDEN, Eli Zaretskii
>  <eliz@HIDDEN>, Sebastian Poeplau <sebastian.poeplau@HIDDEN>
> Date: Sat, 22 Apr 2023 11:08:05 +0200
> 
> This is a continuation of the thread 
>   https://lists.gnu.org/archive/html/emacs-devel/2023-04/msg00206.html
> , where João suggested we should proceed with my simpler patch until we
> hear from Alan.  This message summarizes the current situation:
>   https://lists.gnu.org/archive/html/emacs-devel/2023-04/msg00339.html
> 
> I tested my patch with Sebastian's ada example.

João, any comments?  This discussion seems to have stalled.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 22 Apr 2023 09:08:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 22 05:08:15 2023
Received: from localhost ([127.0.0.1]:41686 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pq9E7-0000j8-8A
	for submit <at> debbugs.gnu.org; Sat, 22 Apr 2023 05:08:15 -0400
Received: from mail-wm1-f46.google.com ([209.85.128.46]:48406)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <felician.nemeth@HIDDEN>) id 1pq9E4-0000iv-TG
 for 62116 <at> debbugs.gnu.org; Sat, 22 Apr 2023 05:08:13 -0400
Received: by mail-wm1-f46.google.com with SMTP id
 5b1f17b1804b1-3f1738d0d4cso16661325e9.1
 for <62116 <at> debbugs.gnu.org>; Sat, 22 Apr 2023 02:08:12 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1682154487; x=1684746487;
 h=mime-version:face:user-agent:message-id:in-reply-to:date:references
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=6LFKrm7xqFVGa6sOBx94/jOq3pd6+4+0CFN5VL6B4W8=;
 b=hjwIipYIz+aeyKkCSlGUbXa8NmhTIZ8aZvSY6CCa5UmRQKFK5lZ5Aj+fsoBBr3V6uN
 ivgVdf4re4wh5dFR1kEPBpnUdqdcNLp5zMh6I9pkfYKinFX43x31ZbO62xJCVaoL/PWF
 Ej1FmUoPmXr0BjRJTxYqyWtv0zmhWaGNGXiZgWXGqtHUEt7HJxdMXEloywazpxwMpnAw
 cqpIR4jDmkSWSHonpf2/xVidL9z0LBKJ8HU9fw/PyZMVxICAfY0efxBdWXUoAGexrP08
 TZn9JN7nXdLqJsBpIlmmeFP5rGmx/ZIE2LtwZnOszV6oNkWHvNY/zrYwUO9qLTVfcm/N
 CAlw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1682154487; x=1684746487;
 h=mime-version:face:user-agent:message-id:in-reply-to:date:references
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=6LFKrm7xqFVGa6sOBx94/jOq3pd6+4+0CFN5VL6B4W8=;
 b=lPBAMNjdMmVvQeIPlwqYL57l8RVIj55ey2XeGDpLMpjuZCmUP7a4DZtEwC61CFZAzJ
 1D87tOBVfhr/B6XwPFZ5gjPg3L6NcaLI/6WvN1uyvn6bPeCzQ1/9FWoMec0s183QOK4t
 ClZd+GMKpl6ZZ5hZ1Q55Nuqj3EcNxl/1LC2BGv1MpdLS7xlsx5M5V8pGYwxCdFSPyPZm
 +lnHoHs0uifgwsLGSqFGneFohFpqCNkPnsS2R/AdH6dEsNGHCWmpT4lplB5gc24ClxN0
 Cx8DqtnDTLfG7GQuqZRRlldJYqI3wa5KUsiK4+YrU/gfTXxCkpVMFr9ZmGxiJ0Scvx7J
 I6lg==
X-Gm-Message-State: AAQBX9eCjhA1LLVNy+coE46TKf3Mi9fhCOZJzUuHdlDPuwA7SCKoUUB9
 Sx0n/c7d6UF7RJijdfOYTfc=
X-Google-Smtp-Source: AKy350b7wY5e4k1rdZvynDb8anJOrrShpLaa4eN2N35qgR6TWnkzcMSDYkOqYkwApMZOj0x0oXWOAg==
X-Received: by 2002:adf:e683:0:b0:2f9:cee4:b8e with SMTP id
 r3-20020adfe683000000b002f9cee40b8emr5095321wrm.68.1682154486735; 
 Sat, 22 Apr 2023 02:08:06 -0700 (PDT)
Received: from betli.gmail.com (catv-86-101-66-128.catv.fixed.vodafone.hu.
 [86.101.66.128]) by smtp.gmail.com with ESMTPSA id
 q16-20020a7bce90000000b003f09d7b6e20sm6974441wmj.2.2023.04.22.02.08.05
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 22 Apr 2023 02:08:06 -0700 (PDT)
From: Felician Nemeth <felician.nemeth@HIDDEN>
To: 62116 <at> debbugs.gnu.org
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN>
 <87v8j7vy48.fsf@HIDDEN> <83r0tuv62t.fsf@HIDDEN>
Date: Sat, 22 Apr 2023 11:08:05 +0200
In-Reply-To: <83r0tuv62t.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 12 Mar
 2023 08:26:02 +0200")
Message-ID: <874jp8gu8a.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEU2EgDVmFNHKAa4dz4q
 AwCDUSH2zWrE61tmAAACeklEQVQ4jU2UwY7jIAyGEZN5ABSFc9Ytcx6K6DmqmHsD8tyZKrz/I+xv
 yI6WKlHlj982tomiVckiWrUrgRU5jlqMpJKCkch5W419DQAiQGHDxdrWmm0/2kXCApiUmrZLq20s
 cjexq3VL25QuxjY7wOcJVEpb+jLeGLAK+OMyaa1hx9rFbkwHFWBVA2y8w1wHaLE7GuDdw5cEuOM5
 SLIdrpwBkN0ezwI7nYoiilqthbcYc89KgC5+NnaOHGbZz0T6BCEgOLJ0vmYXuNdPAIXgDZJhF2Yu
 fjnPNwAsoUTUN/P8q3AAyz4zB/xmifEfiIbvS4jh7b7QqZiSm4MJC5kXNpCRaOsoyQXAMN2XCJfs
 j94NKfo7ACKUEgKE3y+Sg4jibUZ1A0jgYpxtvYMC3gHaHPq6x32ACeALIZoZxB+l9VrRNIA1ncRg
 wwC8pvQIvYO+a2yt3VXMVyli6L0VV6aOrJa4CpilVQA+eHt0xavk61akih5BUMay/0BAqu783C5h
 FifY/3QsAIoWYk6PgpwAzLI652+96e2IfN2cF+BD1uT23F21Ghh5OUl4RlO15oh5A2iv+Zk2wsjZ
 2DtB5Sm3A4P0+kyb2vs4iEW7G9ohoN3Stl2kVat6MCkXldo6OKaE8P6GhmrKKxWZXQH1iklhhn+d
 iVeNf6mDdkV0ltFwApRbp+kXSGBFHGV2aPqnIIyQyzhD5n47khqKI08bIapcas4O+hPkct20NAEv
 ALRuZFUp3PrnQSAm+4lTdHCsYYZ/nGqQrM5z3NS3zefFxkfFPRFbsjpIfbTlvF3ibpVZQ9nzqv60
 F/KXSRLJ1AGappJulZll70N/qz6EfwEOCdYOuTHAzAAAAABJRU5ErkJggg==
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62116
Cc: Eli Zaretskii <eliz@HIDDEN>,
 Sebastian Poeplau <sebastian.poeplau@HIDDEN>,
 =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>, adonovan@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


This is a continuation of the thread=20
  https://lists.gnu.org/archive/html/emacs-devel/2023-04/msg00206.html
, where Jo=C3=A3o suggested we should proceed with my simpler patch until we
hear from Alan.  This message summarizes the current situation:
  https://lists.gnu.org/archive/html/emacs-devel/2023-04/msg00339.html

I tested my patch with Sebastian's ada example.

Thanks.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Eglot-support-window-showDocument-request.patch

From 468a8104183ba46f92d0a194862761c81943c505 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felici=C3=A1n=20N=C3=A9meth?= <felician.nemeth@HIDDEN>
Date: Sat, 22 Apr 2023 10:49:17 +0200
Subject: [PATCH] Eglot: support window/showDocument request

* eglot.el (eglot-client-capabilities): Add showDocument support.
(eglot-handle-request window/showDocument): New cl-defmethod.
---
 lisp/progmodes/eglot.el | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 3134d55fc0..daabb4ff7b 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -830,7 +830,8 @@ eglot-client-capabilities
                                        `(:valueSet
                                          [,@(mapcar
                                              #'car eglot--tag-faces)])))
-            :window `(:workDoneProgress t)
+            :window `(:showDocument (:support t)
+                      :workDoneProgress t)
             :general (list :positionEncodings ["utf-32" "utf-8" "utf-16"])
             :experimental eglot--{})))
 
@@ -2345,6 +2346,28 @@ eglot-handle-request
   "Handle server request workspace/workspaceFolders."
   (eglot-workspace-folders server))
 
+(cl-defmethod eglot-handle-request
+  (_server (_method (eql window/showDocument)) &key
+           uri external takeFocus selection)
+  "Handle request window/showDocument."
+  (if (eq external t)
+      (browse-url uri)
+    (let ((filename (eglot--uri-to-path uri)))
+      (if (eq takeFocus t)
+          (find-file filename)
+        (find-file-noselect filename))
+      (when selection
+        (with-current-buffer (get-file-buffer filename)
+          (save-restriction
+            (widen)
+            (pcase-let ((`(,beg . ,end) (eglot--range-region selection)))
+              (if (equal beg end)
+                  (goto-char beg)
+                (goto-char end)
+                (set-mark-command nil)
+                (goto-char beg))))))))
+  '(:success t))
+
 (defun eglot--TextDocumentIdentifier ()
   "Compute TextDocumentIdentifier object for current buffer."
   `(:uri ,(eglot--path-to-uri (or buffer-file-name
-- 
2.30.2


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 12 Mar 2023 06:26:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 12 01:26:27 2023
Received: from localhost ([127.0.0.1]:58983 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pbFA3-00087Y-DG
	for submit <at> debbugs.gnu.org; Sun, 12 Mar 2023 01:26:27 -0500
Received: from eggs.gnu.org ([209.51.188.92]:38684)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pbFA2-00087L-5u
 for 62116 <at> debbugs.gnu.org; Sun, 12 Mar 2023 01:26:26 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pbF9w-0004tD-FA; Sun, 12 Mar 2023 01:26:20 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=nWnuHH6GOCE+tfXMl31WWXRsA3tb9t4OHCpHr3nzT+Y=; b=md39DrW75dcSEooZu6y3
 iZvoxoeg1JhA4syoPCgSC/EhEnd2wsk8X5fb76GUvaEoP17QJ2p2RWvtcy059KFanAGIjABXRF/9r
 sHFLs5y/t13Tb1dMRJWylco749MpKPBvNUH/xxa0dl/ooK7tBnk0tjneD1uDbrIQqqZ+ZIRphT2nk
 3rru9nGh2/dwLgJ3J5hucHDX/vWCJfUYBVUvIhTxhMlBjBe3hm6AKvZ4+7JV0qZwzRXi2u4ZYeSe9
 6FjyVymbxj63TPzK1fiUFRcJR3v5FL9nAatS0nqkiA8dMeQHlYhPNRavOAUKCFIdIkx/buKi+wzt1
 fneYwIr5D0L9gg==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pbF9q-00015C-RJ; Sun, 12 Mar 2023 01:26:18 -0500
Date: Sun, 12 Mar 2023 08:26:02 +0200
Message-Id: <83r0tuv62t.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
In-Reply-To: <87v8j7vy48.fsf@HIDDEN> (message from =?utf-8?B?Sm/Do28g?=
 =?utf-8?B?VMOhdm9yYQ==?= on Sat, 11 Mar 2023 20:20:23 +0000)
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN> <87v8j7vy48.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62116
Cc: felician.nemeth@HIDDEN, adonovan@HIDDEN, 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: João Távora <joaotavora@HIDDEN>
> Cc: adonovan@HIDDEN,  felician.nemeth@HIDDEN,  62116 <at> debbugs.gnu.org
> Date: Sat, 11 Mar 2023 20:20:23 +0000
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> >> No problem.  Moderation in this bug tracker took a little bit longer
> >> than usual, so this follow up message created a new bug (62116).  I've
> >> closed the other one (62115).  I think future bug reports by you won't
> >> suffer from the same problem.
> >
> > Btw, Alan doesn't seem to have a copyright assignment on file, so
> > before we accept this welcome contribution, we need to have the legal
> > paperwork to be done.
> 
> Yes, and I suggest you send Alan the copyright assignment form.  It's
> always best to have this.

Done off-list.

However, maybe this is not needed, since Alan's address is
@google.com.  Alan, can you confirm that your work is covered by
Google's blanket assignment of copyright?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 11 Mar 2023 20:18:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 11 15:18:34 2023
Received: from localhost ([127.0.0.1]:58734 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pb5fm-0007PZ-2U
	for submit <at> debbugs.gnu.org; Sat, 11 Mar 2023 15:18:34 -0500
Received: from mail-wm1-f45.google.com ([209.85.128.45]:55815)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@HIDDEN>) id 1pb5fj-0007PK-0c
 for 62116 <at> debbugs.gnu.org; Sat, 11 Mar 2023 15:18:32 -0500
Received: by mail-wm1-f45.google.com with SMTP id p16so5508716wmq.5
 for <62116 <at> debbugs.gnu.org>; Sat, 11 Mar 2023 12:18:30 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20210112; t=1678565905;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=YtJN8E1Ca1m8ayF5kFQtwS9cBbiJ5MLBJPB3sI8BqeM=;
 b=SXYEvgDyEfHx+rHQMX+n3Wt48R5AnGkq4VviqHrzlFNfLrQ0OisNdtX3aK8/lM1W3W
 hrKzQ3H0pPKhakTz6NEDS8QyaJQH56N9HaMOEE4fkbs94y6ikrv0Zac5DS8k2/p7Yvzt
 8f09kCyiFopGCdmYwA97DKeGouguHru2moX+8+JhYL/Vg+RlvdDiHRAYE9NsgtZCPkIx
 rnq6pB6p2yVW9vR1N5gydj8rRA2oGD+7xU3MuLiq9cpJ3egOKt/x3X6CjYPT3SqqQYk4
 /zqouX57RrnwWC0+w+XAMEyw2JNrIid8tb/sz6CNzjLuiBZecrwllsEis5G/Wln3TXrv
 a5iQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112; t=1678565905;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=YtJN8E1Ca1m8ayF5kFQtwS9cBbiJ5MLBJPB3sI8BqeM=;
 b=5xeURJunW9a4wDaMSK4qRRuz2+e1eQy09/xVgN7RhcAwGK4Obq6+FvNxQ6WV+TQw4d
 sjeYkO+56vZjqDwi7+cpjK+joApcOpyrlgiBsrcjIZbgvDds+oEgeFQwORTLpysU8GKX
 /NQtCX+90YoQ9pmhJDi9spniDgOhvhuQFrBv+xGDWXKHS2wuZ9w76LqB2lA9SGCecToP
 4FRIvAmp7+Kaqf2yexNN97icrEpPqPhzRLn5sPI742h7rNs18pragVppLfLaT5BlyvFE
 GkDuTD2jXkCtfiFCE2TtELUl6JvOO52e18SOzeAImWPOvlqwyshdbvVVq0/XHvWZ1L5Z
 S4/g==
X-Gm-Message-State: AO0yUKX5b8WOqcg9qU7Zvf7e/PwLIMo+OhqYMIYYPz6YdMh7bIFqvjsB
 QQN+bZ5bpWlTsE1euW0kmFWBekaqCKs=
X-Google-Smtp-Source: AK7set+W0PXniZ9yUP4cINSLZbx5mW8ebenM7Ajp8BgmdR2GmJ0AVoG+kXJMhIJY3kdxPggaIGAHeA==
X-Received: by 2002:a05:600c:3515:b0:3da:acb1:2f09 with SMTP id
 h21-20020a05600c351500b003daacb12f09mr6484557wmq.19.1678565904650; 
 Sat, 11 Mar 2023 12:18:24 -0800 (PST)
Received: from krug ([87.196.72.142]) by smtp.gmail.com with ESMTPSA id
 n14-20020a05600c4f8e00b003eb0d6f48f3sm4033198wmq.27.2023.03.11.12.18.23
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 11 Mar 2023 12:18:24 -0800 (PST)
From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
In-Reply-To: <83fsabwhpg.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 11 Mar
 2023 15:17:15 +0200")
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN> <83fsabwhpg.fsf@HIDDEN>
Date: Sat, 11 Mar 2023 20:20:23 +0000
Message-ID: <87v8j7vy48.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62116
Cc: felician.nemeth@HIDDEN, adonovan@HIDDEN, 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

>> No problem.  Moderation in this bug tracker took a little bit longer
>> than usual, so this follow up message created a new bug (62116).  I've
>> closed the other one (62115).  I think future bug reports by you won't
>> suffer from the same problem.
>
> Btw, Alan doesn't seem to have a copyright assignment on file, so
> before we accept this welcome contribution, we need to have the legal
> paperwork to be done.

Yes, and I suggest you send Alan the copyright assignment form.  It's
always best to have this.

If this somehow becomes a blocker for this specific patch, we could also
opt to first merge Felici=C3=A1n's patch (which precedes this one), then wo=
rk
on some adjustments.

Jo=C3=A3o








Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 11 Mar 2023 13:17:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 11 08:17:38 2023
Received: from localhost ([127.0.0.1]:56772 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1paz6P-00022S-Pw
	for submit <at> debbugs.gnu.org; Sat, 11 Mar 2023 08:17:38 -0500
Received: from eggs.gnu.org ([209.51.188.92]:37246)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1paz6O-00022G-4h
 for 62116 <at> debbugs.gnu.org; Sat, 11 Mar 2023 08:17:36 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1paz6I-0003te-N3; Sat, 11 Mar 2023 08:17:30 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=B81+VAYE8t+cDozhCK2rdNu8T6ZYYGm4IbBGE+xHX8g=; b=pcfr0V5dXarwJcKuiE+f
 c7lIPJ1c6r3jD8ftMl2H97W6s6gzXp2zyzcJLBNH3F4Xt9z40YKwg0ZmRPE8IZi6GFFWXsWQxgoXY
 zT6xBxzxp6nS/B/D2/FwVVV7kJfIycfIPdjHSbq1I+L1Fu9Scxrv/9P0i7SIxayKE9vVqzxyJmv1O
 Ap7R0HkWawYwcHdvyt0XiL3MzesY0jW68h+UBEdGB7CVXu6gm4q96xRnY5FC6wBGs9zyM2S9ZUI9A
 cspA31MP7RM5V0WGRs153uMBuzXFE6zAbDYKHnNnUqVFC4Xo3DrQRd0uNfZ8VPktduk1d0iSEAgS2
 NHbNs1eJsffL7A==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1paz6H-0005bi-Az; Sat, 11 Mar 2023 08:17:30 -0500
Date: Sat, 11 Mar 2023 15:17:15 +0200
Message-Id: <83fsabwhpg.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
In-Reply-To: <87jzznxx8f.fsf@HIDDEN> (message from =?utf-8?B?Sm/Do28g?=
 =?utf-8?B?VMOhdm9yYQ==?= on Sat, 11 Mar 2023 12:56:32 +0000)
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 <87jzznxx8f.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62116
Cc: felician.nemeth@HIDDEN, adonovan@HIDDEN, 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: Felician Nemeth <felician.nemeth@HIDDEN>, 62116 <at> debbugs.gnu.org
> From: João Távora <joaotavora@HIDDEN>
> Date: Sat, 11 Mar 2023 12:56:32 +0000
> 
> Hello Alan!
> 
> > Apologies, that patch contained debugging stuff. Please use this one:
> 
> No problem.  Moderation in this bug tracker took a little bit longer
> than usual, so this follow up message created a new bug (62116).  I've
> closed the other one (62115).  I think future bug reports by you won't
> suffer from the same problem.

Btw, Alan doesn't seem to have a copyright assignment on file, so
before we accept this welcome contribution, we need to have the legal
paperwork to be done.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.

Message received at 62116 <at> debbugs.gnu.org:


Received: (at 62116) by debbugs.gnu.org; 11 Mar 2023 12:54:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 11 07:54:42 2023
Received: from localhost ([127.0.0.1]:56757 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1paykE-0001S3-5m
	for submit <at> debbugs.gnu.org; Sat, 11 Mar 2023 07:54:42 -0500
Received: from mail-wm1-f54.google.com ([209.85.128.54]:42793)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@HIDDEN>) id 1paykB-0001Rl-QV
 for 62116 <at> debbugs.gnu.org; Sat, 11 Mar 2023 07:54:40 -0500
Received: by mail-wm1-f54.google.com with SMTP id
 o11-20020a05600c4fcb00b003eb33ea29a8so5112498wmq.1
 for <62116 <at> debbugs.gnu.org>; Sat, 11 Mar 2023 04:54:39 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20210112; t=1678539274;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=/9wlwvORpfYKk7PSOYP2vedOYJXqTEY60rhfUgtXs40=;
 b=RV95ayDEPebDwOHkIi8EWUhxHqJvD8Q1yvf8jK4nk1KSPbqoroaBRgg0mcf+y12Tol
 s/IqHe7MfjG6mrPTMn+FyG+0WuGicYDhXH8TXqvPwA70KWQjBiIKuV8/5qqWKg20erda
 SZ/j/kWoRezn5NJr1zwHaJHxBZE9nsIWoOsUwnYIe2bwaRLO/PtKbCAxe5/7AdCpERi2
 JJFk8eIynCv58OZbRogfgvPhMZ8Sx6amsuWClHxo6UYynCdbyjM3j0Zq84SptrGOT6zt
 DSLcRLwpjckAoBQ6ABE89YvBtaK/nN6w9HJnhXs+fPv3iGetXIYQECPtzhfsy8qd0wbE
 giXQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112; t=1678539274;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=/9wlwvORpfYKk7PSOYP2vedOYJXqTEY60rhfUgtXs40=;
 b=V1n/KrQMTFqXJe26gtuJUcifjyUkELJdBYWsfY8n5YDO/yQ6O5zaWfNx5LcL4l/ba6
 nmGZ2MH7Zvc5AkVrFgTzm6QJWaROQTPvsXog4t+VS7/N6cplGdHQFt1MSIwgWAC2lfR5
 i2Q0nfdBJR4L3xOXEaR8NgBFk2PdL7ubj2mYIg/cQK5qOX+BPK2XgFJXhITxSc2bXRnf
 ReldyHixc23sw+qmbSKikbivh6xpUh8H0f2ePirAL5OgNVRegqVey/JqQvtQXVGzj/XI
 JmqTIDmWQnk3xJsS4jzf33Mzqhns7/B3hCOq+/bi84RzFemv2QvlCfMOPs/hLmoDMVkv
 qd9g==
X-Gm-Message-State: AO0yUKUuA5LSIQU10wZmjyiuI5M8yacd+kO3YeQ/rQPhBDUDjkkNvlZ6
 RDilekDkfowDYLq/2A6tFkg=
X-Google-Smtp-Source: AK7set/KKKqDf5iH2LKFSIMGO/gB85kIinOaxa5zg+B4rZbi9jIjlhkZZch8ZgYjyhOwL4dMsQQHZw==
X-Received: by 2002:a05:600c:190a:b0:3e0:6c4:6a38 with SMTP id
 j10-20020a05600c190a00b003e006c46a38mr5601264wmq.33.1678539273839; 
 Sat, 11 Mar 2023 04:54:33 -0800 (PST)
Received: from krug (87-196-72-142.net.novis.pt. [87.196.72.142])
 by smtp.gmail.com with ESMTPSA id
 r14-20020adff70e000000b002c5804b6afasm2304505wrp.67.2023.03.11.04.54.32
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 11 Mar 2023 04:54:33 -0800 (PST)
From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
To: Alan Donovan <adonovan@HIDDEN>
Subject: Re: bug#62116: RFE: eglot: support window.showDocument LSP RPC
In-Reply-To: <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
 (Alan Donovan's message of "Fri, 10 Mar 2023 10:40:01 -0500")
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
 <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
Date: Sat, 11 Mar 2023 12:56:32 +0000
Message-ID: <87jzznxx8f.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62116
Cc: Felician Nemeth <felician.nemeth@HIDDEN>, 62116 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello Alan!

> Apologies, that patch contained debugging stuff. Please use this one:

No problem.  Moderation in this bug tracker took a little bit longer
than usual, so this follow up message created a new bug (62116).  I've
closed the other one (62115).  I think future bug reports by you won't
suffer from the same problem.

>> This patch can be applied to the base commit of 8ee205d. Please let me
>> know if you'd like it in some other form.

This form is fine.  Comments below.

> diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
> index 2f8d2002cd3..fb0c5cb1199 100644
> --- a/lisp/progmodes/eglot.el
> +++ b/lisp/progmodes/eglot.el
> @@ -819,6 +819,7 @@ treated as in `eglot--dbind'."
>                                           [,@(mapcar
>                                               #'car eglot--tag-faces)])))
>              :general (list :positionEncodings ["utf-32" "utf-8" "utf-16"=
])
> +            :window '(:showDocument (:support t))
>              :experimental eglot--{})))
>=20=20
>  (cl-defgeneric eglot-workspace-folders (server)
> @@ -2143,6 +2144,44 @@ COMMAND is a symbol naming the command."
>    (_server (_method (eql window/logMessage)) &key _type _message)
>    "Handle notification window/logMessage.") ;; noop, use events buffer
>=20=20
> +(cl-defmethod eglot-handle-request
> +  (_server (_method (eql window/showDocument)) &key uri external takeFoc=
us selection
> +           &allow-other-keys)
> +  "Handle a window/showDocument server->client request by opening the
> +URL in a browser or within Emacs."
> +  ;; Note: browse-url on a "file:" URL will execute open(1) or xdg-open(=
1),
> +  ;; which may end up opening the file in Emacs (or some other editor th=
at
> +  ;; has registered the *.go extension), ignoring the optional selection.

Not fully correct, as browse-url may well open things within Emacs own
web browser, eww.  I propose you leave just the next line.

> +  ;; Typically servers send "External: false" for files.

In your experience, do servers differentiate between files inside the
LSP "workspace" (in Emacs' parlance, the project) and outside it?  A
file visited by find-file inside the project becomes "managed" by
Eglot+server, where a file outside the project becomes just a buffer
(that could be managed by a different server).  Not saying this is a
problem, just interested in how this is used in the wild.

> +  (if (and external (not (eq external :json-false)))
> +      (browse-url uri)
> +    ;; Don't call find-file immediately (within the RPC handler) since
> +    ;; find-file's go-mode hooks issue more LSP RPCs (e.g.
> +    ;; textDocument/documentSymbol) from within this one, which then
> +    ;; gets stuck. (Is that a bug in gopls?)
> +    ;; So, make the call asynchronously from the idle loop.
> +    ;; Of course this means we can't respond with the proper success val=
ue.

Yep, I don't like this, and that's only one of the reasons.  I'd only do
this if there is no better alternative, and I don't think we've
exhausted them yet (even then, you probably want simply
'run-with-timer').

First, I've made some changes to Eglot's usage of find-file-hook
recently, and I'd like to ensure you're running the latest eglot from
Emacs 29 or Emacs master (there are some pretest binaries for the
latter, I think).

Then I would ask you to try to find a backtrace of that
'textDocument/documentSymbol call that presumably Eglot sends
immediately after visiting the file.  Maybe the problem can be fixed
there or thereabouts.

One way to obtain that backtrace might be to do:

   (unwind-protect
       (progn
          (debug-on-entry 'jsonrpc-request)
          ;; synchronous find-file logic
       )
     (cancel-debug-on-entry 'jsonrpc-request))

If you can, repeat the process with 'jsonrpc-notify instead of as well
which will maybe produce a different backtrace.  If it does, show that
too.

It's quite likely that the problem can be fixed upstream, so that a more
naive implementation can work.

> +    (run-with-idle-timer 0 nil
> +                         #'(lambda (filename noselect selection)

Just some notes, since we're probably not going to use a lambda here.
First #'(lambda (...) ) is redudant here.  Also, since Emacs has lexical
scoping (for about a decade now), you can have an argless lambda and
access variables from the inside

> +                                   (with-current-buffer (if noselect
> +                                                            (find-file-n=
oselect filename)

I don't think LSP's understanding of "focus" is the same as in
'find-file-noselect'.  In Emacs, I would model it on the concept of
selected window.  IOW

  (funcall (if focus #'pop-to-buffer #'display-buffer)
           (find-file-noselect filename))

might be closer to what you want.  But only testing can tell.


> +                                                          (x-focus-frame=
 nil)

This is going to be problematic for some users, I suspect.  Let's leave
it for now.  What is the use case?  An interactive app with a "find
definition" interface?  That's cool, the Common Lisp IDE's I use all
have this.

> +                                                          (find-file fil=
ename))
> +                                     (when selection
> +                                       (save-restriction
> +                                         (widen)

You're saving the user's restriction, widening, then restoring it, but
why?  If the intended region is outside, it will have no effect, so
perhaps just check that 'beg' and 'end' are between 'point-min' and
'point-max'.  Alternatively, just nuke the user's restriction (you're
moving lots of other stuff anyway).

> +                                         (pcase-let ((`(,beg . ,end) (eg=
lot--range-region selection)))
> +                                           (if (equal beg end)
> +                                               (goto-char beg)
> +                                             (goto-char end)
> +                                             (set-mark-command nil)
> +                                             (goto-char beg))
> +                                           (recenter))))))

If you can show me how, I'd like to test this myself.  i have gopls
installed, and a minimal toolchain, but I'm missing a project where I
can exercise this (and probably I'm also missing the mandatory "server
configuration" options).  So a simple recipe with the smallest project
possible would be nice.

We're probably also going to need some user-confirmation UI for this.
But that can come later.

Jo=C3=A3o





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.
Added tag(s) patch. Request was from João Távora <joaotavora@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 11 Mar 2023 04:10:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 10 23:10:57 2023
Received: from localhost ([127.0.0.1]:56378 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1paqZM-0007Wi-VB
	for submit <at> debbugs.gnu.org; Fri, 10 Mar 2023 23:10:57 -0500
Received: from lists.gnu.org ([209.51.188.17]:52414)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <adonovan@HIDDEN>) id 1paeqv-0005qa-Bc
 for submit <at> debbugs.gnu.org; Fri, 10 Mar 2023 10:40:17 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <adonovan@HIDDEN>)
 id 1paeqv-0003ds-1K
 for bug-gnu-emacs@HIDDEN; Fri, 10 Mar 2023 10:40:17 -0500
Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <adonovan@HIDDEN>)
 id 1paeqt-0007K4-Bm
 for bug-gnu-emacs@HIDDEN; Fri, 10 Mar 2023 10:40:16 -0500
Received: by mail-pf1-x42f.google.com with SMTP id b20so3889400pfo.6
 for <bug-gnu-emacs@HIDDEN>; Fri, 10 Mar 2023 07:40:14 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=google.com; s=20210112; t=1678462813;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=tZlBrfNCESEbS75ZpyI2zEGvVhJVWbPhKp4+h+ZpT5w=;
 b=tI2rzy1+nuxJLv6rz8WoW2C4pQLvvB3TQmbfMu1MiGIjfAn3Vph7+QVcFQU3SXdhxj
 0Cm5VhFYoPfi3nvM9P5qfpuMj3m/i52v9RToRKaNFffO7B/iOiRy4zC/Au7uHKjy9xHQ
 ow09cE8y1qlnaWW6m1hQA0yCQY1HbXfvwMAmblTIqIT4UptsFkMI7pfNSJRn6NF87gVC
 Kb/KITuEePvjW5NHO9u5A+lOWkz4vlezZFZWfb5GsEeNzITKhueNQSXQugV2TKtR2ziv
 0NaV7NHrkAuU/ay9O0eJuu7bC4Lq7TUTDCz1RxvH+HA0y+HI5qzrzEs8RYy0QBlP1yQE
 FGDQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112; t=1678462813;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=tZlBrfNCESEbS75ZpyI2zEGvVhJVWbPhKp4+h+ZpT5w=;
 b=dsxuD61bFjF8v1QVZOUtvdW7ovezt50NaAwjy56Dur++gl0qcQac877WWFtmgg3KKt
 5/3bvSxal+ImV2sBtZrpx3Si734k3kITsdBjL4U5e00fXEFFOrpQWvnj8CGuagbOT6US
 kqF0bpMzdlgjV5p6tezUgGZM83EIW3/rXeDejnPVxEAfm3A47Kfzvt9DTehRoVdGxPi2
 d/aWu1kK7eHVUq8+kMO7ZizbDbt/Rv/ZsIEzGLludQF1B7tc2IItrXLThLPo5Akt6K5p
 MIpr8eCCLgH9+Inrml70HUZLse1cDnX/s9ffxvLktqCq1e1RCmt8f2fdy1yDZfQ6IG4k
 hfgA==
X-Gm-Message-State: AO0yUKX64oXKUWg53yAm4udDgF9+0/9r+HV4sfyXmBI+nTgVjq7+wVaw
 JF05Svdls1/qLQzlnlYof5Y4w+qNcVXj9xRDpE9vQOmv2nG9bmNlCma5pA==
X-Google-Smtp-Source: AK7set85PU6LxfEc0NlkIlC3VqREgJsG+M5wiGHzknGtw81LrfHvhD0xFgoBtNBJUvrtH4DMcgJPgI47nMysjWyII10=
X-Received: by 2002:a62:820e:0:b0:5af:db19:b1c with SMTP id
 w14-20020a62820e000000b005afdb190b1cmr11113604pfd.2.1678462812999; Fri, 10
 Mar 2023 07:40:12 -0800 (PST)
MIME-Version: 1.0
References: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
In-Reply-To: <CAPVWWDXQiFwuFi3G0jOOFSwj6YJ-Rmd8n0cZSOphiKK+RuQnZA@HIDDEN>
From: Alan Donovan <adonovan@HIDDEN>
Date: Fri, 10 Mar 2023 10:40:01 -0500
Message-ID: <CAPVWWDUKRzSGfSRjJnMZBfhEZF3S29P8qGyQRUMABbpF9z40MA@HIDDEN>
Subject: Re: RFE: eglot: support window.showDocument LSP RPC
To: bug-gnu-emacs@HIDDEN
Content-Type: multipart/mixed; boundary="000000000000bded4005f68d9312"
Received-SPF: pass client-ip=2607:f8b0:4864:20::42f;
 envelope-from=adonovan@HIDDEN; helo=mail-pf1-x42f.google.com
X-Spam_score_int: -175
X-Spam_score: -17.6
X-Spam_bar: -----------------
X-Spam_report: (-17.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001,
 DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001, USER_IN_DEF_DKIM_WL=-7.5,
 USER_IN_DEF_SPF_WL=-7.5 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Fri, 10 Mar 2023 23:10:52 -0500
Cc: joaotavora@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--000000000000bded4005f68d9312
Content-Type: text/plain; charset="UTF-8"

Apologies, that patch contained debugging stuff. Please use this one:



On Fri, 10 Mar 2023 at 10:34, Alan Donovan <adonovan@HIDDEN> wrote:
>
> Attn: Joao Tavora
>
> The attached patch adds basic support to eglot for the
> window.showDocument downcall, added in LSP 3.16, which enables the
> server to request that
> the client open an URL either in an external browser (e.g. as if by
> the open(1) or xdg-open(1) command) or internally, in the editor.
> https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#window_showDocument
>
> See also https://github.com/joaotavora/eglot/discussions/1180.
>
> Thanks to @nemethf, whose unmerged PR
> https://github.com/joaotavora/eglot/pull/855 provided numerous
> improvements over my own first draft.
>
> This patch can be applied to the base commit of 8ee205d. Please let me
> know if you'd like it in some other form.
>
> cheers
> alan

--000000000000bded4005f68d9312
Content-Type: application/octet-stream; name="eglot-showDocument.patch"
Content-Disposition: attachment; filename="eglot-showDocument.patch"
Content-Transfer-Encoding: base64
Content-ID: <f_lf2pdt330>
X-Attachment-Id: f_lf2pdt330

ClRoaXMgcGF0Y2ggYWRkcyBiYXNpYyBzdXBwb3J0IHRvIGVnbG90IGZvciB0aGUgd2luZG93LnNo
b3dEb2N1bWVudApkb3duY2FsbCwgYWRkZWQgaW4gTFNQIDMuMTYsIHdoaWNoIGVuYWJsZXMgdGhl
IHNlcnZlciB0byByZXF1ZXN0IHRoYXQKdGhlIGNsaWVudCBvcGVuIGFuIFVSTCBlaXRoZXIgaW4g
YW4gZXh0ZXJuYWwgYnJvd3NlciAoZS5nLiBhcyBpZiBieQp0aGUgb3BlbigxKSBvciB4ZGctb3Bl
bigxKSBjb21tYW5kKSBvciBpbnRlcm5hbGx5LCBpbiB0aGUgZWRpdG9yLgoKaHR0cHM6Ly9taWNy
b3NvZnQuZ2l0aHViLmlvL2xhbmd1YWdlLXNlcnZlci1wcm90b2NvbC9zcGVjaWZpY2F0aW9ucy9s
c3AvMy4xNy9zcGVjaWZpY2F0aW9uLyN3aW5kb3dfc2hvd0RvY3VtZW50CgpTZWUgYWxzbyBodHRw
czovL2dpdGh1Yi5jb20vam9hb3Rhdm9yYS9lZ2xvdC9kaXNjdXNzaW9ucy8xMTgwLgoKVGhhbmtz
IHRvIEBuZW1ldGhmLCB3aG9zZSB1bm1lcmdlZCBQUgpodHRwczovL2dpdGh1Yi5jb20vam9hb3Rh
dm9yYS9lZ2xvdC9wdWxsLzg1NSBwcm92aWRlZCBudW1lcm91cwppbXByb3ZlbWVudHMgb3ZlciBt
eSBvd24gZmlyc3QgZHJhZnQuCgpkaWZmIC0tZ2l0IGEvbGlzcC9wcm9nbW9kZXMvZWdsb3QuZWwg
Yi9saXNwL3Byb2dtb2Rlcy9lZ2xvdC5lbAppbmRleCAyZjhkMjAwMmNkMy4uZmIwYzVjYjExOTkg
MTAwNjQ0Ci0tLSBhL2xpc3AvcHJvZ21vZGVzL2VnbG90LmVsCisrKyBiL2xpc3AvcHJvZ21vZGVz
L2VnbG90LmVsCkBAIC04MTksNiArODE5LDcgQEAgdHJlYXRlZCBhcyBpbiBgZWdsb3QtLWRiaW5k
Jy4iCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFssQChtYXBjYXIK
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICMnY2FyIGVnbG90
LS10YWctZmFjZXMpXSkpKQogICAgICAgICAgICAgOmdlbmVyYWwgKGxpc3QgOnBvc2l0aW9uRW5j
b2RpbmdzIFsidXRmLTMyIiAidXRmLTgiICJ1dGYtMTYiXSkKKyAgICAgICAgICAgIDp3aW5kb3cg
Jyg6c2hvd0RvY3VtZW50ICg6c3VwcG9ydCB0KSkKICAgICAgICAgICAgIDpleHBlcmltZW50YWwg
ZWdsb3QtLXt9KSkpCiAKIChjbC1kZWZnZW5lcmljIGVnbG90LXdvcmtzcGFjZS1mb2xkZXJzIChz
ZXJ2ZXIpCkBAIC0yMTQzLDYgKzIxNDQsNDQgQEAgQ09NTUFORCBpcyBhIHN5bWJvbCBuYW1pbmcg
dGhlIGNvbW1hbmQuIgogICAoX3NlcnZlciAoX21ldGhvZCAoZXFsIHdpbmRvdy9sb2dNZXNzYWdl
KSkgJmtleSBfdHlwZSBfbWVzc2FnZSkKICAgIkhhbmRsZSBub3RpZmljYXRpb24gd2luZG93L2xv
Z01lc3NhZ2UuIikgOzsgbm9vcCwgdXNlIGV2ZW50cyBidWZmZXIKIAorKGNsLWRlZm1ldGhvZCBl
Z2xvdC1oYW5kbGUtcmVxdWVzdAorICAoX3NlcnZlciAoX21ldGhvZCAoZXFsIHdpbmRvdy9zaG93
RG9jdW1lbnQpKSAma2V5IHVyaSBleHRlcm5hbCB0YWtlRm9jdXMgc2VsZWN0aW9uCisgICAgICAg
ICAgICZhbGxvdy1vdGhlci1rZXlzKQorICAiSGFuZGxlIGEgd2luZG93L3Nob3dEb2N1bWVudCBz
ZXJ2ZXItPmNsaWVudCByZXF1ZXN0IGJ5IG9wZW5pbmcgdGhlCitVUkwgaW4gYSBicm93c2VyIG9y
IHdpdGhpbiBFbWFjcy4iCisgIDs7IE5vdGU6IGJyb3dzZS11cmwgb24gYSAiZmlsZToiIFVSTCB3
aWxsIGV4ZWN1dGUgb3BlbigxKSBvciB4ZGctb3BlbigxKSwKKyAgOzsgd2hpY2ggbWF5IGVuZCB1
cCBvcGVuaW5nIHRoZSBmaWxlIGluIEVtYWNzIChvciBzb21lIG90aGVyIGVkaXRvciB0aGF0Cisg
IDs7IGhhcyByZWdpc3RlcmVkIHRoZSAqLmdvIGV4dGVuc2lvbiksIGlnbm9yaW5nIHRoZSBvcHRp
b25hbCBzZWxlY3Rpb24uCisgIDs7IFR5cGljYWxseSBzZXJ2ZXJzIHNlbmQgIkV4dGVybmFsOiBm
YWxzZSIgZm9yIGZpbGVzLgorICAoaWYgKGFuZCBleHRlcm5hbCAobm90IChlcSBleHRlcm5hbCA6
anNvbi1mYWxzZSkpKQorICAgICAgKGJyb3dzZS11cmwgdXJpKQorICAgIDs7IERvbid0IGNhbGwg
ZmluZC1maWxlIGltbWVkaWF0ZWx5ICh3aXRoaW4gdGhlIFJQQyBoYW5kbGVyKSBzaW5jZQorICAg
IDs7IGZpbmQtZmlsZSdzIGdvLW1vZGUgaG9va3MgaXNzdWUgbW9yZSBMU1AgUlBDcyAoZS5nLgor
ICAgIDs7IHRleHREb2N1bWVudC9kb2N1bWVudFN5bWJvbCkgZnJvbSB3aXRoaW4gdGhpcyBvbmUs
IHdoaWNoIHRoZW4KKyAgICA7OyBnZXRzIHN0dWNrLiAoSXMgdGhhdCBhIGJ1ZyBpbiBnb3Bscz8p
CisgICAgOzsgU28sIG1ha2UgdGhlIGNhbGwgYXN5bmNocm9ub3VzbHkgZnJvbSB0aGUgaWRsZSBs
b29wLgorICAgIDs7IE9mIGNvdXJzZSB0aGlzIG1lYW5zIHdlIGNhbid0IHJlc3BvbmQgd2l0aCB0
aGUgcHJvcGVyIHN1Y2Nlc3MgdmFsdWUuCisgICAgKHJ1bi13aXRoLWlkbGUtdGltZXIgMCBuaWwK
KyAgICAgICAgICAgICAgICAgICAgICAgICAjJyhsYW1iZGEgKGZpbGVuYW1lIG5vc2VsZWN0IHNl
bGVjdGlvbikKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHdpdGgtY3VycmVu
dC1idWZmZXIgKGlmIG5vc2VsZWN0CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAoZmluZC1maWxlLW5vc2VsZWN0IGZpbGVuYW1lKQor
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICh4LWZvY3VzLWZyYW1lIG5pbCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAoZmluZC1maWxlIGZpbGVuYW1lKSkKKyAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAod2hlbiBzZWxlY3Rpb24KKyAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgIChzYXZlLXJlc3RyaWN0aW9uCisgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICh3aWRlbikKKyAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgKHBjYXNlLWxldCAoKGAoLGJlZyAuICxlbmQpIChlZ2xvdC0t
cmFuZ2UtcmVnaW9uIHNlbGVjdGlvbikpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgIChpZiAoZXF1YWwgYmVnIGVuZCkKKyAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgKGdvdG8tY2hhciBiZWcpCisgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZ290by1jaGFyIGVuZCkKKyAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChzZXQtbWFyay1jb21tYW5kIG5pbCkK
KyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChnb3RvLWNoYXIg
YmVnKSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAocmVjZW50
ZXIpKSkpKSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAoZWdsb3QtLXVyaS10by1wYXRoIHVy
aSkgOyBmaWxlbmFtZQorICAgICAgICAgICAgICAgICAgICAgICAgIChvciAobnVsbCB0YWtlRm9j
dXMpIChlcSB0YWtlRm9jdXMgOmpzb24tZmFsc2UpKSA7IG5vc2VsZWN0CisgICAgICAgICAgICAg
ICAgICAgICAgICAgc2VsZWN0aW9uKSkKKyAgJyg6c3VjY2VzcyB0KSkKKwogKGNsLWRlZm1ldGhv
ZCBlZ2xvdC1oYW5kbGUtbm90aWZpY2F0aW9uCiAgIChfc2VydmVyIChfbWV0aG9kIChlcWwgdGVs
ZW1ldHJ5L2V2ZW50KSkgJnJlc3QgX2FueSkKICAgIkhhbmRsZSBub3RpZmljYXRpb24gdGVsZW1l
dHJ5L2V2ZW50LiIpIDs7IG5vb3AsIHVzZSBldmVudHMgYnVmZmVyCg==
--000000000000bded4005f68d9312--




Acknowledgement sent to Alan Donovan <adonovan@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#62116; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 4 Sep 2023 09:00:02 UTC

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