minad / cape

🦸cape.el - Completion At Point Extensions
GNU General Public License v3.0
584 stars 20 forks source link

Add cape-yasnipet #17

Closed Crandel closed 2 years ago

Crandel commented 2 years ago

Thank you @minad for such a nice project! Is it possible to add cape-yasnipet completion function? Company-yasnippet is built-in into company-mode and I want to skip installing whole package only for this functionality.

minad commented 2 years ago

Thanks!

cape-yasnippet is out of scope of Cape since it depends on a third-party package. Maybe someone will create a yasnippet-capf package at some point? In the meantime you can either use consult-yasnippet if you use Consult or you can install Company and use company-yasnippet via the cape-company-to-capf adapter.

If you are interested in digging a bit deeper, you can also take the file company-yasnippet.el and remove the company dependency (remove all calls to company functions). This is actually easy to do since there are not many such calls and the existing ones can be replaced with builtins. After having done that you will end up with a Company-style backend (which still uses the Company API) but without the Company dependency. You can use this backend with the cape-company-to-capf adapter. In the next step and if you haven't lost interested by then you could convert the API from the Company API to the default Capf API. Then we would end up with a yasnippet-capf backend which could be packaged up and distributed separately.

Please let me know if you have further questions.

Crandel commented 2 years ago

Thank you for quick response. I will definitely try consult-yasnippet as I use consult a lot.

minad commented 2 years ago

I saw the thread on reddit and created https://github.com/minad/tempel. It is not yasnippet but at least it is simple :)

Crandel commented 2 years ago

Looks promising, I will try it

maikol-solis commented 1 year ago

This package/script works reasonably nice

https://github.com/elken/cape-yasnippet