cursorless-dev / cursorless

Don't let the cursor slow you down

Home Page:https://www.cursorless.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

keyboard: support ordinal modifiers

pokey opened this issue · comments

Some links:

  • Search the code base for nextPrev. You'll need to make a new type of token called ordinal that functions identically to nextPrev, but creates an ordinalScope modifier instead of the relativeScope created by nextPrev
  • Here is the shape of the ordinal modifier you'll end up creating from our keyboard grammar:
    /**
    * Refer to scopes by absolute index relative to iteration scope, eg "first
    * funk" to refer to the first function in a class.
    */
    export interface OrdinalScopeModifier {
    type: "ordinalScope";
    scopeType: ScopeType;
    /** The start of the range. Start from end of iteration scope if `start` is negative */
    start: number;
    /** The number of scopes to include. Will always be positive. If greater than 1, will include scopes after {@link start} */
    length: number;
    /** If true, yields individual targets instead of contiguous range. Defaults to `false` */
    isEvery?: boolean;
    }