Skip to content

Rework Talon side to use destinations #1440

@pokey

Description

@pokey
  • Update Talon side
  • Add deprecation warning if user says "to after"? I believe we support this today, and some users are still saying that, as indicated by slack questions from the past month. We could probably have this as an alternate spoken form for "after" and show a warning if they use it
  • Add destination box to the cheatsheet with "before target", "to target" and "after target"
  • Update "paste", "bring", "move" and others in cheatsheet to accept a destination and link to that box
  • Add destination to public api, and use it for snippets
  • Fix 'paste' documentation #1319

Talon side

On the Talon side, we would like to do the following:

1. Make "before", "after" and "to" into "insertion modes"

We'll have a new list called cursorless_insertion_mode, which will consist of "before", "after" and "to".

These terms should also be removed from both cursorless_position and cursorless_source_destination_connective.

Note that "end of" and "start of" remain as position modifiers.

2. Add new capture for destinations

Replace the <cursorless_positional_target> capture with the following:

@mod.capture(
    rule=(
        "{user.cursorless_insertion_mode} <user.cursorless_target> "
        "({user.cursorless_list_connective} {user.cursorless_insertion_mode} <user.cursorless_target>)*"
    )
)
def cursorless_destination(m) -> list[dict]:
    return {
        "type": "destinationList",
        "destinations": [
            {
                "type": "destination",
                "insertionMode": insertion_mode,
                "target": target,
            }
            for insertion_mode, target in zip(m.cursorless_insertion_mode, m.cursorless_target)
        ]
    }

Note that we are using the cursorless_target capture as part of this capture, which can contain its own "and"s. That's how we support "after air and bat and before cap".

We would then use this new cursorless_destination capture wherever we use cursorless_positional_target today.

Note that we might instead want to do something like we do with targets, where the primitive destination can appear at the top level when there is no "and"

Problems

  • We already have "before" and "after" in positions.csv, and "to" in connectives.csv, but ideally we'd move them into the same file as each other

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions