From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#73279: [PATCH] Eglot: use immediate-mode eglot--request for :completionItem/resolve Date: Mon, 16 Sep 2024 14:28:38 +0300 Message-ID: <86wmjbdehl.fsf@gnu.org> References: <87v7ywoh7m.fsf@taipei.mail-host-address-is-not-set> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="969"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 73279@debbugs.gnu.org To: Brennan Vincent , =?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 Mon Sep 16 13:30:21 2024 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 1sq9vx-000Acc-BK for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 Sep 2024 13:30:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sq9vV-0000qZ-R6; Mon, 16 Sep 2024 07:29:53 -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 1sq9vS-0000px-69 for bug-gnu-emacs@gnu.org; Mon, 16 Sep 2024 07:29:50 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sq9vR-0003qo-Ss for bug-gnu-emacs@gnu.org; Mon, 16 Sep 2024 07:29:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-version:References:In-Reply-To:From:Date:To:Subject; bh=kgfOUv6FQk0gjePvb9La2XS7WZKGxn8gmtHmMiXf39g=; b=PqENpveyVm1hiQShhb9litjtvepkxHBJj44gGNnSUzDtUyqqXIHXby0CB9ptocpYZpJFI/e73MN8X+3YdIlr3Fzf3GpacEKfWTWnoU/K12WpfxbWv1y6reM8UkJqGX5UwMKeJH3DAPO05xcidAMyGclJ2NfLJ6NaSYNRVCPrYRYuryNZi6GmWrviKqpssi60BtsAje5kYtAwN8I7BBzrTdbnIvB+LiKmBlsy/XTxuK+mR5VEev/AnjTieAQFU6LfTNmPlk6k5XSDpd1Q0+urNhW8PEmE9n6jrubdCet4Af2AyG41+6AvN1QzJleJTWF21x2xtz/sgXre4afvOcaoAQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sq9ve-0001Tt-MS for bug-gnu-emacs@gnu.org; Mon, 16 Sep 2024 07:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 Sep 2024 11:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73279 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 73279-submit@debbugs.gnu.org id=B73279.17264861515600 (code B ref 73279); Mon, 16 Sep 2024 11:30:02 +0000 Original-Received: (at 73279) by debbugs.gnu.org; 16 Sep 2024 11:29:11 +0000 Original-Received: from localhost ([127.0.0.1]:51173 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sq9up-0001SF-Bb for submit@debbugs.gnu.org; Mon, 16 Sep 2024 07:29:11 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:39562) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sq9un-0001S0-DF for 73279@debbugs.gnu.org; Mon, 16 Sep 2024 07:29:10 -0400 Original-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 ) id 1sq9uS-0003ot-Rr; Mon, 16 Sep 2024 07:28:50 -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=kgfOUv6FQk0gjePvb9La2XS7WZKGxn8gmtHmMiXf39g=; b=AXjuXy7kT0cQgJd0w/YV p0BRZuq+SL/VRnVcN8KYOJzOGDkjXc7xlv4b1hJ3IMWC0dEQeE+6pI3h2hKXOULeOTeNrMY21G273 pWHHyAqG6uFP1vFKYbP1+kgJuzCmKRPf51uRsnExINb2VVfvkZU3bz4bNfPIcKId3JGfgYJiY4C34 zoJg5qCX+k2RLRobG5sQyKy2GnmOFVQKbFXIdiQpeWYxBPXg8Jp5pRL3RNWxODcR4tZzuWrRUvxXa KR0bBpFmvBRsvOKgKLoF5HO4cKQUvMm4e/c4rClTL2PRTfVuCUVpxvZzbCfg14g5/nVHYbQwVu0GG yb56Fa67K3gNGA==; In-Reply-To: <87v7ywoh7m.fsf@taipei.mail-host-address-is-not-set> (message from Brennan Vincent on Sun, 15 Sep 2024 15:22:05 -0400) 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:291881 Archived-At: > From: Brennan Vincent > Date: Sun, 15 Sep 2024 15:22:05 -0400 > > * lisp/progmodes/eglot.el: use immediate-mode eglot--request for > :completionItem/resolve in eglot-completion-at-point. > > With the previous behavior, we are informing the language server of the > modified state of the buffer after initially inserting the completion, > but before fully resolving the completion item. > > This confuses rust-analyzer (and maybe others, I don't know) and causes > it not to return the correct set of additionalTextEdits. > > A simple Rust program that reveals the issue follows. Put the point > after HashSet and attempt to complete. With the previous behavior, the > language server fails to tell us to insert "use > std::collections::HashSet" at the top of the file. With the new behavior > as of this commit, completion works successfully (as it did in emacs > 29.4). > > struct S { > x: T > } > > impl S> { > } > > fn main() {} > --- > lisp/progmodes/eglot.el | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el > index 82e99a2c920..e9de099d2cd 100644 > --- a/lisp/progmodes/eglot.el > +++ b/lisp/progmodes/eglot.el > @@ -3229,7 +3229,9 @@ eglot-completion-at-point > :resolveProvider) > (plist-get lsp-comp :data)) > (eglot--request server :completionItem/resolve > - lsp-comp :cancel-on-input t) > + lsp-comp > + :cancel-on-input t > + :immediate t) > lsp-comp)))))) > (when (and (consp eglot--capf-session) > (= (car bounds) (car (nth 0 eglot--capf-session))) > -- > 2.45.2 Joćo, any comments?