Skip to content

Fluent chaining after a "bring" / "move" #414

Open
@pokey

Description

@pokey

The problem

Today, it is difficult / impossible to issue a single command phrase in which a "bring" / "move" command is followed by a command that modifies the newly copied / moved target, because the new text won't contain any hats until after the phrase has ended. We'd like to remove this limitation, enabling more fluent coding with longer command chains

Here's an example:

function foo() {
   |
}

const bar = baz("bongo")

In the above, our cursor is in the function foo, and we'd like to move the statement declaring bar to our cursor location, fluently changing the function call argument to be hello. Here's the desired end state:

function foo() {
   const bar = baz(hello)
}

Possible solutions

These solutions are not mutually exclusive; it is better to have multiple ways to accomplish this task so that the user / situation can determine the best approach. For each approach, we indicate at the end the exact command phrase that the user could issue to accomplish the above example.

Option 1: Hat migration [yes]

  • Automatically move the hats from the source to the target immediately after a "bring" / "move". This approach would result in a single hat corresponding to multiple locations in the case of a single-source-multiple-destination broadcast move (eg "bring funk air to after bat and cap")
    • We could create an alternate term for the source hats as well, eg "source gust", etc
    • Alternately we could leave the old hats and have the new ones be called "that gust" or "new gust"

Example: "move state zip clear arg gust word hello"

Note: This behaviour already occurs with "clone"

Tracker issue:

Option 2: "taking" [no]

  • Add an optional clause at the end of "bring" / "move" called "taking" which moves the selection to the corresponding piece of the new target. So if you say "bring funk air taking arg bat", it would create a copy of the function, selecting the argument in the new target corresponding to the argument "bat" in the source

Example: "move state zip taking arg gust word hello"

Option 3: Selection migration [yes]

  • Make it so that if the user has selection(s) within the source, the selections will be moved to the corresponding place in the new target, similar to how we do for "clone"

Example: "take arg gust move state back word hello"

Tracker issue:

Option 4: Relative scopes [yes]

Example: "move state zip clear next arg word hello"

Tracker issue:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions