move items 2.0: move {left,right} or {before,after} and {add, remove} #8340
Labels
A-assists
fun
A technically challenging issue with high impact
S-actionable
Someone could pick this issue up and work on it right now
The item movers feature (#8054, #6823) is really cool. I'd like for it to be explored further. I have some ideas. Let me know if I should create separate issue for each, but I fear this isn't something you want to explore. Here are the ideas:
Idea#1: Left & Right
My initial idea was to also enable moving left and right. This would allow moving left and right the following:
fn x(z, y)
tofn x(y,z)
x(z,y)
tox(y,z)
move item left
andmove item right
commands would have the same UI "API" for the user as currentlymove item up
andmove item down
do now.Idea#2 Add & Remove
New commands:
add item
andremove item
.Remove item
is pretty simple as it removes the given provided function arguments, tuple items, struct generics, struct lifetimes etc.Add item
is more tricky as it wouldn't make much sense in the context of a tuple or function, but it would be pretty nice for struct generics.Add item
could work for (including but not limited to):for tuple items
Very simply just adds the provided type to the end, left and right could be used by the user after.
for a function
It would first add an argument with the type provided by the user to the end, and then the user could move it left and right to their liking to place it where they want
type bounds requirements on the struct definition for the given arguments and update all the
impl
s to also include the new bound. Same goes forremove item
in this context.For example, given
struct SomeStruct<T: Sized>
with your cursor anywhere inT: Sized
is you could hit theAdd item
command, popup appears and you type inDebug
as the other one, and the following happens:struct SomeStruct<T: Sized + Debug>
impl<T: Sized + Debug> for SomeStruct {..}
struct generic arguments/parameters
For example for a
struct SomeStruct<T:Sized>
with you cursour anywhere in theSomeStruct
adding another item would add another type likestruct SomeStruct<T: Sized, U: ProvidedByUser>
. WithProvidedByUser
being inputed with some sort of popup.Idea#3 Before & after
This idea is to replace {up,down,left,right} with a more general solution: before and after. Moving a function "before" would have the same semantics as moving it up currently; conversely for down and "before". Moving an argument "before" would move it as Idea#1's left; conversely for Idea#1's right.
Ideally I would love for the combination of Idea#2 and Idea#3. Also, given Idea#2 and Idea#3 one could have the basics for a future
Change signature
type of refactor where the user could get a nice UI for modifying the given signature to the new one, as all signature refactoring is moving, renaming, adding and removing (correct me if I'm wrong); but given Idea#2 and Idea#3 the user could in theory do the wholechange signature
action manually by calling the necessary commands themselves. Another nice addition would be #2178The text was updated successfully, but these errors were encountered: