branch: elpa/cider
commit d430ab314f7f59cf88e19fe4629bb46a1108ddbb
Author: Oleksandr Yakushev <[email protected]>
Commit: Bozhidar Batsov <[email protected]>

    [complete] Prioritize flex style if flex style is requested
---
 CHANGELOG.md                   | 2 ++
 cider-completion.el            | 2 +-
 test/cider-completion-tests.el | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index acce10fb35..54ef88a462 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,8 @@
 
 ### Bugs fixed
 
+- [#3696](https://github.com/clojure-emacs/cider/pull/3696): Don't eagerly 
complete a candidate if there are other candidates matching `flex` style.
+
 ## 1.14.0 (2024-05-30)
 
 ### New features
diff --git a/cider-completion.el b/cider-completion.el
index bd23c38593..a2a91ae57d 100644
--- a/cider-completion.el
+++ b/cider-completion.el
@@ -297,7 +297,7 @@ Only affects the `cider' completion category.`"
     (unless found-styles
       (setq found-styles '(styles basic)))
     (unless (member 'flex found-styles)
-      (setq found-styles (append found-styles '(flex))))
+      (setq found-styles (apply #'list 'styles 'flex (cdr found-styles))))
     (add-to-list 'completion-category-overrides (apply #'list 'cider 
found-styles (when found-cycle
                                                                                
     (list found-cycle))))))
 
diff --git a/test/cider-completion-tests.el b/test/cider-completion-tests.el
index e80f4253ae..a8f58f798b 100644
--- a/test/cider-completion-tests.el
+++ b/test/cider-completion-tests.el
@@ -37,7 +37,7 @@
       (unwind-protect
           (progn
             (it "adds `flex' and `basic' as a fallback"
-              (let ((expected-category-overrides '((cider (styles basic 
flex)))))
+              (let ((expected-category-overrides '((cider (styles flex 
basic)))))
                 (cider-enable-flex-completion)
                 (expect (member 'flex (assq 'styles (assq 'cider 
completion-category-overrides)))
                         :to-be-truthy)

Reply via email to