From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Donovan via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#62116: RFE: eglot: support window.showDocument LSP RPC Date: Fri, 12 May 2023 16:46:42 -0400 Message-ID: References: <87jzznxx8f.fsf@gmail.com> <83fsabwhpg.fsf@gnu.org> <87v8j7vy48.fsf@gmail.com> <83r0tuv62t.fsf@gnu.org> <874jp8gu8a.fsf@betli.tmit.bme.hu> <838re3jowg.fsf@gnu.org> <87ttwqsow9.fsf@gmail.com> <87ttwpbpaj.fsf@betli.tmit.bme.hu> <875y93arek.fsf@betli.tmit.bme.hu> <87h6sla14k.fsf@betli.tmit.bme.hu> <871qjm5pzk.fsf@gmail.com> Reply-To: Alan Donovan Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17359"; mail-complaints-to="usenet@ciao.gmane.io" Cc: sebastian.poeplau@mailbox.org, Felician Nemeth , 62116@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 12 22:48:20 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pxZga-0004Jw-5U for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 12 May 2023 22:48:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pxZgK-0000Q4-Ud; Fri, 12 May 2023 16:48:04 -0400 Original-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 ) id 1pxZgI-0000OK-KG for bug-gnu-emacs@gnu.org; Fri, 12 May 2023 16:48:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pxZgI-00028E-Bi for bug-gnu-emacs@gnu.org; Fri, 12 May 2023 16:48:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pxZgH-000776-RL for bug-gnu-emacs@gnu.org; Fri, 12 May 2023 16:48:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Donovan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 May 2023 20:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62116 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 62116-submit@debbugs.gnu.org id=B62116.168392442327116 (code B ref 62116); Fri, 12 May 2023 20:48:01 +0000 Original-Received: (at 62116) by debbugs.gnu.org; 12 May 2023 20:47:03 +0000 Original-Received: from localhost ([127.0.0.1]:33631 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pxZfL-00073I-Bg for submit@debbugs.gnu.org; Fri, 12 May 2023 16:47:03 -0400 Original-Received: from mail-pl1-f179.google.com ([209.85.214.179]:37009) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pxZfH-00072n-PP for 62116@debbugs.gnu.org; Fri, 12 May 2023 16:47:01 -0400 Original-Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1ac65ab7432so554555ad.0 for <62116@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) In-Reply-To: <871qjm5pzk.fsf@gmail.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:261646 Archived-At: 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 = wrote: > > Felician Nemeth writes: > > > Jo=C3=A3o T=C3=A1vora 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 >