all messages for Emacs-related lists mirrored at yhetil.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; 8+ 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] 8+ messages in thread

end of thread, other threads:[~2024-09-16 17:06 UTC | newest]

Thread overview: 8+ 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

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.