unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#73279: [PATCH] Eglot: use immediate-mode eglot--request for :completionItem/resolve
@ 2024-09-15 19:22 Brennan Vincent
  2024-09-16 11:28 ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Brennan Vincent @ 2024-09-15 19:22 UTC (permalink / raw)
  To: 73279

* 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







^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-10-09 12:12 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
2024-09-25 15:14               ` Brennan Vincent
2024-09-26 10:27                 ` João Távora
2024-09-26 10:58                   ` Eli Zaretskii
2024-10-06 12:13                     ` Brennan Vincent
2024-10-09 11:50                       ` João Távora
2024-10-09 12:12                         ` Brennan Vincent

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