[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 4dcbf61c151: Eglot: Make 'try-completion' less broken

From: João Távora
Subject: master 4dcbf61c151: Eglot: Make 'try-completion' less broken
Date: Tue, 26 Dec 2023 08:54:44 -0500 (EST)

branch: master
commit 4dcbf61c1518dc53061707aeff8887517e050003
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Eglot: Make 'try-completion' less broken
    The 'try-completion' completion operation, used mostly in vanilla
    'completion-at-point' invoked with C-M-i is close to impossible to get
    right in LSP because of the arbitrary edits handled in
    When this operation is invoked on the table, returning the pattern
    argument unchanged somehow (TM) makes a sole completion show the
    *Completions* buffer, where selecting it will recover context
    necessary for `:exit-function' and call that function.  It doesn't
    break any other cases I know, and that's good enough for now.
    * lisp/progmodes/eglot.el (eglot-completion-at-point): Return pattern
    when 'try-completion' is invoked.
 lisp/progmodes/eglot.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index d777e488c43..a97c9e2a3e0 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -3113,8 +3113,8 @@ for which LSP on-type-formatting should be requested."
           ((eq action 'lambda)                           ; test-completion
            (test-completion pattern (funcall proxies)))
           ((eq (car-safe action) 'boundaries) nil)       ; boundaries
-          ((null action)                                 ; try-completion
-           (try-completion pattern (funcall proxies)))
+          ((null action)                                 ; try-completion 
+           pattern)
           ((eq action t)                                 ; all-completions
            (let ((comps (funcall proxies)))
              (dolist (c comps) (eglot--dumb-flex pattern c t))
@@ -3215,7 +3215,8 @@ for which LSP on-type-formatting should be requested."
                         ;; was obtained from server. If a `proxy'
                         ;; "bar" was obtained from a buffer with
                         ;; "foo.b", the LSP edit applies to that
-                        ;; state, _not_ the current "foo.bar".
+                        ;; state, _not_ the current "foo.bar"
+                        ;; (github#1339)
                         (delete-region orig-pos (point))
                         (insert (substring bounds-string (- orig-pos (car 
                         (eglot--dbind ((TextEdit) range newText) textEdit

reply via email to

[Prev in Thread] Current Thread [Next in Thread]