How to make yasnippets show up in the completion menu while using sly?

I would like my yasnippets to show up at the top of the autocompletion popup when I use sly, but haven’t been able to figure out how to do so… I’m using the systemcrafters config with corfu for autocompletion, and this is my yasnippet config:

(use-package yasnippet
  :ensure t
  :bind (("C-c C-<return>" . #'yas-expand))
  :config
  (add-to-list 'yas-snippet-dirs "~/dots/emacs/snippets")
  (yas-global-mode 1))
(use-package yasnippet-capf
  :ensure t
  :after cape
  :config
  (add-to-list 'completion-at-point-functions #'yasnippet-capf))

The snippets do work, and they show up in some modes (org, elisp, sclang), but not in lisp mode when using sly.

Any help much appreciated!

OK, getting a bit further here… For some reason yasnippet is not added to completion-at-point-functions. The value of this in a lisp buffer is

(sly-complete-filename-maybe
 sly-complete-symbol)

If I run (add-to-list 'completion-at-point-functions #'yasnippet-capf) manually it becomes

(yasnippet-capf
 sly-complete-filename-maybe
 sly-complete-symbol)

but then I only get the yasnippet completion. The sly-complete-* functions no longer show in the completion popup.

I think some completion-at-point-functions “short-circuit” everything else and so you don’t get to see other possible completions. Have you tried GitHub - minad/cape: 🦸cape.el - Completion At Point Extensions merging multiple capfs together via the cape package? This worked for me when I was playing around with merging yasnippets with everything else.

1 Like

Thanks! Will give it a try when I have a bit more time.