Skip to content

Issue with cider complete #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
benjamin-asdf opened this issue Oct 18, 2021 · 12 comments
Closed

Issue with cider complete #89

benjamin-asdf opened this issue Oct 18, 2021 · 12 comments

Comments

@benjamin-asdf
Copy link

benjamin-asdf commented Oct 18, 2021

Hi,
my issue is for completing when the prefix is "foo/" (with / in the name). Somehow orderless-filter only decides to call the completing function with the empty string but never with "foo/" which would yield the correct completions.
Do you know why and can you help me fix this in some way?
Thanks for the awesome package.

If you need a repro I can check if I can make a minimal one.

@minad
Copy link
Collaborator

minad commented Oct 18, 2021

See clojure-emacs/cider#3019

@minad
Copy link
Collaborator

minad commented Oct 18, 2021

The issue can be fixed by using a style dispatcher which adds a ^ before the first component. Alternatively combine the basic completion style with orderless.

793eb0e

@benjamin-asdf
Copy link
Author

Will check thanks

@benjamin-asdf
Copy link
Author

benjamin-asdf commented Oct 18, 2021

(defun mm/cider-style-dispatcher
    (component idx count)
  (when
      (eq idx 0)
    (concat "^" component)))

(setq
 orderless-style-dispatchers
 '(mm/cider-style-dispatcher))

tried like this but it did not do the trick yet. Adding 'basic to completion styles does help though.

@minad
Copy link
Collaborator

minad commented Oct 18, 2021

If basic works then the orderless style dispatcher you wrote should work too. Please check if you use the newest version etc and if indeed orderless passes the first component to the completion function instead of the empty string as it did before.

@benjamin-asdf
Copy link
Author

benjamin-asdf commented Oct 18, 2021

Yea cider-complete still get's called with empty string on commit 62f71c3.
(+ using the style dispatcher I posted)

@minad
Copy link
Collaborator

minad commented Oct 18, 2021 via email

@benjamin-asdf
Copy link
Author

benjamin-asdf commented Oct 18, 2021

Nice thanks a lot. Now I only need a way to only enable this for cider completions.
Setting it buffer local in cider buffers only works halfway because then it's not set for completion-at-point in the minibuffer I guess.

I achieved the above with something along those lines:

(defun mm/patch-orderless-style ()
  (setq-local
   orderless-style-dispatchers
'(orderless-prefix-dispatch)))


(defun my-completion-at-point ()
  (interactive)
    (let ((minibuffer-setup-hook
	   (if cider-mode
	       (append
		minibuffer-setup-hook
		'(mm/patch-orderless-style))
	     minibuffer-setup-hook)))
      (completion-at-point)))

@abcdw
Copy link

abcdw commented Nov 30, 2022

I can't reproduce it. Can someone else check it the problem is still present?

Ok, I just had a basic as a fallback style.

@minad
Copy link
Collaborator

minad commented Nov 30, 2022

Using basic as fallback is perfectly fine for dynamic tables.

@oantolin
Copy link
Owner

I think the current recommendation in the documentaton to use basic as a fallback is godd enough to close this issue, no? If not, we can reopen.

@abcdw
Copy link

abcdw commented Dec 1, 2022

I did the following trick, which is a little dirty, but works quite well: clojure-emacs/cider#3019 (comment)

image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants