Skip to content

Implement generic "every" logic #797

Closed
@pokey

Description

@pokey
  • For "every <scope> this" with empty selection, expand to iteration scope and yield every scope in that range
  • For "every <scope> this" with non-empty selection, yield every scope that has non-empty overlap with selection
  • For "every <scope> air", expand to iteration scope and yield every scope in that range
  • For "every <scope> block", yield every scope that has non-empty overlap with selection

For reference, this is what weakness looks like:

  • For "if wrap this" with empty selection, wrap containing statement
  • For "if wrap this" with non-empty selection, wrap containing statement
  • For "if wrap air", wrap containing statement
  • For "if wrap block", just wrap exact block

Possible solution is to change CursorMarkStage to only return weak target if selection is empty. In that case, weakness for wrap now looks like:

  • For "if wrap this" with empty selection, wrap containing statement
  • For "if wrap this" with non-empty selection, just wrap exact selection
  • For "if wrap air", wrap containing statement
  • For "if wrap block", just wrap exact block

Then we would make it so that for "every", we expand to iteration scope for weak targets and for non weak targets we yield every scope that overlaps. Then our proposal at the top works because the first in the third are week so they expand to iteration scope but the second in the fourth do not the because they are not weak

Ideally as much as possible is implemented in new EveryScopeStage, but will need to think a bit about how much autonomy scope handlers need

We should probably let EveryScopeStage decide whether to expand to iteration scope, and then just pass input target content range and Boolean indicating whether to expand

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions