-
-
Notifications
You must be signed in to change notification settings - Fork 156
How to support snippets on code actions expansions. #74
Comments
Should be possible if there's some exported api in the completion plugins (nvim-cmp / compe) |
This all really depends if a snippet plugin adds support for this, because its out of scope for this plugin |
It makes sense. Should this issue be closed? I'll keep an eye on the vim-vsnip issue. Thanks! |
Let's keep it open for now |
So I think it should be implemented in rust-tools.nvim. But I also think it is too harder because snippet and textEdit both are complex implementation. |
I think rust-tools.nvim should get the snippet expansion function as a configuration item. (nvim-cmp does it). And You can override the |
I would expect it to work like this where you can configure how the snippet gets expanded: https://github.com/hrsh7th/nvim-cmp/blob/main/README.md?plain=1#L70-L81 |
Yes I would prefer this as well, but the snippet extenstions would have to actually support the SnippetTextEdits that are given by rust analyzer which aren't supported by any afaik |
Yep we plan to do it if snippet plugins are down to add support |
I don't know if this is related, but when using rust_analyzer with lspconfig without rust-tools I get this expansion on "fill match arms": match c {
Test::A(_) => todo!(),
Test::B(_) => todo!(),
Test::C { a, b, c } => todo!(),
} But with rust-tools this happens: match c {
Test::A(${0:_}) => todo!(),
Test::B(_) => todo!(),
Test::C { a, b, c } => todo!(),
} Maybe it is possible to have the lspconfig expansion for now, until the cursor move is implemented, as that code is at least compilable? |
I agree for now I can't really use rust-tools for that :s |
Fixed with 0190496 Edit: Don't think we'll ever support actual snippets, but now we replace the placeholders with the defaults so its valid rust code. |
If I have the following code:
and I use the code action
Implement missing members
, the generated code is:I am using vim-vsnip for regular snippets.
I don't know if this is in the scope of rust-tools or not.
The text was updated successfully, but these errors were encountered: