From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#62116: RFE: eglot: support window.showDocument LSP RPC Date: Mon, 15 May 2023 09:48:50 +0100 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> 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="36521"; mail-complaints-to="usenet@ciao.gmane.io" Cc: sebastian.poeplau@mailbox.org, Felician Nemeth , 62116@debbugs.gnu.org To: Alan Donovan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 15 10:50:26 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 1pyTuU-0009Kk-3b for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 May 2023 10:50:26 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pyTu9-0002ZL-16; Mon, 15 May 2023 04:50:05 -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 1pyTu6-0002Uc-Q7 for bug-gnu-emacs@gnu.org; Mon, 15 May 2023 04:50: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 1pyTu6-0005X5-6f for bug-gnu-emacs@gnu.org; Mon, 15 May 2023 04:50:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pyTu5-0005Dw-KF for bug-gnu-emacs@gnu.org; Mon, 15 May 2023 04:50:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 May 2023 08:50: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.168414055120012 (code B ref 62116); Mon, 15 May 2023 08:50:01 +0000 Original-Received: (at 62116) by debbugs.gnu.org; 15 May 2023 08:49:11 +0000 Original-Received: from localhost ([127.0.0.1]:42703 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pyTtG-0005Ci-V7 for submit@debbugs.gnu.org; Mon, 15 May 2023 04:49:11 -0400 Original-Received: from mail-ot1-f51.google.com ([209.85.210.51]:48242) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pyTtE-0005CU-MX for 62116@debbugs.gnu.org; Mon, 15 May 2023 04:49:10 -0400 Original-Received: by mail-ot1-f51.google.com with SMTP id 46e09a7af769-6ab1942ea59so4717336a34.0 for <62116@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) In-Reply-To: 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:261731 Archived-At: On Fri, May 12, 2023 at 9:46=E2=80=AFPM Alan Donovan = 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