elken / yasnippet-capf

Completion-At-Point Extension for YASnippet
GNU General Public License v3.0
40 stars 9 forks source link

I can't get it to work #23

Closed agzam closed 4 months ago

agzam commented 4 months ago

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.

agzam commented 4 months ago

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)