Generics
bendk opened this issue · comments
Checklist
- Have you read through
:h nvim-surround
to see if there might be any relevant information there?
Is your feature request related to a problem? Please describe.
Thanks for the great plugin. One feature I'd love to see is generic support, similar to functions. For example, if I'm editing a Rust file and have Foo
under the cursor, I'd love to be able to type ysiwgBox
to turn that into Box<Foo>
. The feature would work exactly the same as function surrounds, but just use <>
instead of ()
.
Additional context
You have a nice configuration system and I found it pretty easy to add this myself for Rust, but built-in support would be even better.
Hi there, since this would be a filetype-specific configuration and only really applicable to {cpp, rust, java, typescript} and similar, I would prefer to keep the core body of the plugin simple, and "offload" any more specific configuration to the end user. I'm open to hearing any other points you may have about it though. You can also feel free to check/post to #53.
Fair enough, that makes sense to me. The main reason I'd like to see it built-in is that I'm not sure my treesitter node type will work with other languages. If it was part of the repo, then maybe others could add support for those. That said, it doesn't really feel like nvim-surround needs to handle that issue. I'll post to #53 and close this one.
I think the "real" solution would be to write some query for nvim-treesitter-textobjects (or similar) that would handle all of the filetypes and group them under one umbrella, then match on query instead of treesitter node. Thanks for understanding!