minad / corfu

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

Does it support postfix completion #334

Closed dragove closed 1 year ago

dragove commented 1 year ago

I'm trying to use postfix completion with corfu and eglot. Postfix snippets are provided by some language servers. (e.g. rust-analyzer, jdtls). When I typed something like

let x = true;
x.if

and at the point after if. I can expand it to

let x= true;
if x {
    // after expanding cursor position
}

I can't find these snippets in corfu with eglot. So I'm looking for help here.

minad commented 1 year ago

Yes, this should work. Afaik you should install yasnippet for the snippet expansion.

dragove commented 1 year ago

Yes, this should work. Afaik you should install yasnippet for the snippet expansion.

I've installed tempEl, And After I typed

let my_var = true;
my_var.if 

And call tempel-expand to expand, it becomes

let my_var = true;
my_var.if | {
|
}

The | symbol is to present placeholders.

minad commented 1 year ago

Tempel doesn't support such a postfix expansion where the entity before point is transformed into the first argument of the template.