elken/yasnippet-capf

I can't get it to work

Closed this issue · 1 comments

I have yasnippet installed and corfu and cape, but even when completion-at-point-functions is set to '(yasnippet-capf), in a buffer where yas-minor-mode is enabled, completion-at-point command doesn't show any candidates. Even though (yasnippet-capf-candidates) returning some stuff, etc.

I tried debugging (yasnippet-capf), to see if it at all is getting triggered.

Setting a breakpoint after when (thing-at-point-looking-at hits it. But it never gets into lambda (input) body. I wonder why.

Initially it appeared not working for me in clojure-mode. Then I realized that it works in other modes. After digging a bit I found that clojure-lsp adds its own snippets, and they can be conflicting with yasnippet's. Also, apparently stacking up completion-at-point-functions can confuse it, e.g., if you have cape-dabbrev or cape-dict before yasnippet-capf and a snippet with a trivial key, typing the key would show suggestions from other completions but not yas. I fixed it by creating a "super capf":

  (defalias 'cape-cider-lsp-yas
    (cape-capf-super #'cider-complete-at-point
                     #'lsp-completion-at-point
                     #'yasnippet-capf))

  (add-to-list 'completion-at-point-functions #'cape-cider-lsp-yas)