]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix eglot-completion-at-point for multiple matches
authorFelicián Németh <felician.nemeth@gmail.com>
Sat, 11 Jan 2020 19:12:26 +0000 (20:12 +0100)
committerJoão Távora <joaotavora@gmail.com>
Sat, 16 Jan 2021 13:33:10 +0000 (13:33 +0000)
The test-completion case shouldn't return t when there are multiple
matches.  Similarly, the try-completion should return t only if the
match is exact.  See (info "(elisp)Programmed Completion").

* eglot.el (eglot-completion-at-point): Instead of testing
memberships, use test-completion and try-completion suggested
by (info "(elisp)Programmed Completion").

* eglot-tests.el (non-unique-completions): Add new test.

Co-authored-by: João Távora <joaotavora@gmail.com>
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/365

lisp/progmodes/eglot.el

index 0447bc850417ca884519da02128f98c51666d1bc..98fa4d9af6f92517cef07ebbe696001a53369863 100644 (file)
@@ -2154,10 +2154,10 @@ is not active."
          (cond
           ((eq action 'metadata) metadata)               ; metadata
           ((eq action 'lambda)                           ; test-completion
-           (member probe (funcall proxies)))
+           (test-completion probe (funcall proxies)))
           ((eq (car-safe action) 'boundaries) nil)       ; boundaries
-          ((and (null action)                            ; try-completion
-                (member probe (funcall proxies)) t))
+          ((null action)                                 ; try-completion
+           (try-completion probe (funcall proxies)))
           ((eq action t)                                 ; all-completions
            (cl-remove-if-not
             (lambda (proxy)