minad / corfu

:desert_island: corfu.el - COmpletion in Region FUnction
GNU General Public License v3.0
1.11k stars 43 forks source link

corfu and ESS: accessing list elements without having first to select list #450

Closed maxecharel closed 5 months ago

maxecharel commented 5 months ago

Hi @minad,

I've tried corfu with eglot, works pretty well (amazing work, as always). I decided to give it a try with ESS, which relies on CAPF + some Company-specific backends (so I also took that as an opportunity to try cape; also a really cool package).

In R, dataframes are named lists, and their elements (i.e. features/columns/variables) can be accessed using the $ operator. In the example below, I consider iris, a builtin dataset, but the result is the same if I assign it to foo or bar.

With Company, I can type (in one shot) iris$, and the popup will suggests the different elements it contains: acess_list_elements_ess_company

However, I failed to have Corfu behaving the same way. If I type iris$ in one shot, Corfu will only suggest the corresponding object candidate, that is, iris. I then have to select it, and then use the $ operator to have Corfu suggesting the different elements of the list: access_list_elements_ess_corfu

I tried to play with corfu-preselect, but didn't succeed to get the desired behavior. Same when I tried to change the order the different backends were added to completion-at-point-functions via cape-company-to-capf.

Is there a way to make corfu behave the way company does? Could my problem be due to the fact that corfu treats as $ as the regex metacharacter?

Thanks a lot for the great work!

Best, M

Emacs 29.3 Corfu 20240409.438 (Melpa) Cape 20240411.2207 (Melpa)