[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot 83cd785 12/49: Fix #365: Fix eglot-completion-at-
From: |
Stefan Monnier |
Subject: |
[elpa] externals/eglot 83cd785 12/49: Fix #365: Fix eglot-completion-at-point for multiple matches |
Date: |
Wed, 17 Mar 2021 18:41:44 -0400 (EDT) |
branch: externals/eglot
commit 83cd78581758876d55de69431a58cd491afba7f1
Author: Felicián Németh <felician.nemeth@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
Fix #365: Fix eglot-completion-at-point for multiple matches
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>
---
eglot-tests.el | 17 +++++++++++++++++
eglot.el | 6 +++---
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/eglot-tests.el b/eglot-tests.el
index 47286a7..852b65a 100644
--- a/eglot-tests.el
+++ b/eglot-tests.el
@@ -502,6 +502,23 @@ Pass TIMEOUT to `eglot--with-timeout'."
(completion-at-point)
(should (looking-back "sys.exit")))))
+(ert-deftest non-unique-completions ()
+ "Test completion resulting in 'Complete, but not unique'"
+ (skip-unless (executable-find "pyls"))
+ (eglot--with-fixture
+ '(("project" . (("something.py" . "foo=1\nfoobar=2\nfoo"))))
+ (with-current-buffer
+ (eglot--find-file-noselect "project/something.py")
+ (should (eglot--tests-connect))
+ (goto-char (point-max))
+ (completion-at-point))
+ ;; FIXME: `current-message' doesn't work here :-(
+ (with-current-buffer (messages-buffer)
+ (save-excursion
+ (goto-char (point-max))
+ (forward-line -1)
+ (should (looking-at "Complete, but not unique"))))))
+
(ert-deftest basic-xref ()
"Test basic xref functionality in a python LSP"
(skip-unless (executable-find "pyls"))
diff --git a/eglot.el b/eglot.el
index 0447bc8..98fa4d9 100644
--- a/eglot.el
+++ b/eglot.el
@@ -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)
- [elpa] externals/eglot updated (4edd478 -> 97ed4ca), Stefan Monnier, 2021/03/17
- [elpa] externals/eglot 926d0594 01/49: Close #575: Use flex completion if available by default, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot 4c85df2 02/49: Close #212: Don't block in eglot-imenu if performing non-essential task, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot 16bbf85 03/49: Fix #582: flex completion style is not available on Emacs < 27, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot ceac05c 05/49: Fix #593: Unbreak interactivee eglot--connect for complex contact specs, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot 83cd785 12/49: Fix #365: Fix eglot-completion-at-point for multiple matches,
Stefan Monnier <=
- [elpa] externals/eglot 9da9d69 04/49: C-u M-x eglot discards class guessed by eglot--guess-contact, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot 51f1320 09/49: Skip downloading GNU ELPA deps on make check by default, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot 6370a1c 10/49: Fix some of eglot-tests.el for new Eldoc library, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot 8761f86 11/49: Unbreak eglot-dcase test, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot 0c4daa4 13/49: Fix #531: mention M-x eldoc as preferred documentation command, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot e5a9648 07/49: Fix #513: use `path-separator', not ":", in Eclipse/JDT custom code, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot e6ca70c 14/49: Close #599: add rnix-lsp server for nix-mode, community suggestion, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot 1f2b024 23/49: Close #605: Support activeParameter property for SignatureInformation, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot 2fc0db8 33/49: Fix #467: make eglot-ignored-server-capabilites defcustom a set, Stefan Monnier, 2021/03/17
- [elpa] externals/eglot 1a54fc0 40/49: Per #627: URIfy better, Stefan Monnier, 2021/03/17