minad / cape

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

`cape-company-to-capf` wrong cursor focus after completion #28

Closed jilen closed 2 years ago

jilen commented 2 years ago

With company, after completion(function), the cursor will focus on the first parameter, and can use tab to navigate to next parameter. This behavior is lost after transformed with cape-company-to-capf.

minad commented 2 years ago

Which company function did you use?

jilen commented 2 years ago

Haven't tried builtin company backends.
But a custom backend defined here https://ensime.github.io/downloads/ensime-tng-3.0.0.tar.gz. Which is a little complicated to setup.

jilen commented 2 years ago

Hm, I cannot find anything related to cursor focus with compeletion-at-point-functions maybe it just impossible to deal with cursor pos after completion.

minad commented 2 years ago

The post argument expansion, cursor handling happens here:

https://github.com/phillord/ensime-emacs/blob/7ad5cd6957b6a68c4064b74aecd31320bb91b4da/ensime-company.el#L240

It uses yasnippet. cape-company-to-capf calls the post-completion action here:

https://github.com/minad/cape/blob/e5e11f30f0b6ed0a2b283d5d3dec84bcd36557fc/cape.el#L955-L958

In principle this should work. I know for sure that post completion expansion works with cape-company-to-capf for other backends so I assume that it is an issue with either your config or ensime. Can you debug this further?

jilen commented 2 years ago

Ok, let me have a try.

jilen commented 2 years ago

Found it depends on company-template which was not loaded with my setup. Thanks for point out the right direction.