unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Brennan Vincent" <brennan@umanwizard.com>,
	"João Távora" <joaotavora@gmail.com>
Cc: 73279@debbugs.gnu.org
Subject: bug#73279: [PATCH] Eglot: use immediate-mode eglot--request for :completionItem/resolve
Date: Mon, 16 Sep 2024 14:28:38 +0300	[thread overview]
Message-ID: <86wmjbdehl.fsf@gnu.org> (raw)
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)

> From: Brennan Vincent <brennan@umanwizard.com>
> 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<T> {
>     x: T
> }
> 
> impl<T> S<HashSet<T>> {
> }
> 
> 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?





  reply	other threads:[~2024-09-16 11:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-15 19:22 bug#73279: [PATCH] Eglot: use immediate-mode eglot--request for :completionItem/resolve Brennan Vincent
2024-09-16 11:28 ` Eli Zaretskii [this message]
2024-09-16 13:43   ` João Távora
2024-09-16 15:17     ` Brennan Vincent
2024-09-16 15:40       ` João Távora
2024-09-16 15:50         ` João Távora
2024-09-16 16:21           ` João Távora
2024-09-16 17:06             ` Brennan Vincent

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86wmjbdehl.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=73279@debbugs.gnu.org \
    --cc=brennan@umanwizard.com \
    --cc=joaotavora@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).