One editing operation that often comes up is wrapping a subtree in another node.
An example that happened to me recently in Rust if changing Type to Option<Type> in several places.
It'd be really great if we could have such wrapping operation built-in, as that'd help with these. However there's an interesting case - what if I wanted to wrap into Result? Which type parameter should be picked?
I envision something like this:
wo - wrap as Option<T>, no indication is needed as it's obviously one
w1r - wrap as Result<T, _>
w2r - wrap as Result<_, T>
w1o - same as wo
wr - error because of ambiguity (but equivalent to w1r would also make sense as this operation is more common in case of Result)
Dot command should work with this too, also multi-cursor operations. (Select all occurrences of Type within a subtree and wrap them.)
One editing operation that often comes up is wrapping a subtree in another node.
An example that happened to me recently in Rust if changing
TypetoOption<Type>in several places.It'd be really great if we could have such wrapping operation built-in, as that'd help with these. However there's an interesting case - what if I wanted to wrap into
Result? Which type parameter should be picked?I envision something like this:
wo- wrap asOption<T>, no indication is needed as it's obviously onew1r- wrap asResult<T, _>w2r- wrap asResult<_, T>w1o- same aswowr- error because of ambiguity (but equivalent tow1rwould also make sense as this operation is more common in case ofResult)Dot command should work with this too, also multi-cursor operations. (Select all occurrences of
Typewithin a subtree and wrap them.)