cursorless icon indicating copy to clipboard operation
cursorless copied to clipboard

Generate cheatsheet extension-side

Open pokey opened this issue 2 years ago • 0 comments

The way we generate the cheatsheet today is a bit of a hack. We'd like to generate it extension-side using the new spoken form sharing mechanism.

We could have a list of canonical command fragments, using the placeholder mechanism described in https://github.com/cursorless-dev/cursorless/issues/2096, and then generate the spoken form and description from each of these canonical command fragments. For example:

actions = [
  {
    name: "remove",
    target: PLACEHOLDER,
  },
  {
    name: "pasteFromClipboard",
    destination: PLACEHOLDER,
  },
];

scopeTypes = [
  {
    type: "line",
  },
  {
    type: "surroundingPair",
    delimiter: PLACEHOLDER,
  },
];

modifiers = [
  {
    type: "relativeScope",
    scopeType: PLACEHOLDER,
    offset: GREATER_THAN_ZERO,
  }, {
    type: "relativeScope",
    scopeType: PLACEHOLDER,
    offset: 0,
  },
];

Then we can run generate spoken form to get the following entries for actions:

  • "chuck <target>" => remove <target>
  • "paste <destination>" => paste from clipboard at <destination>

and for scope types:

  • "line" => line
  • "<delimiter>" => <delimiter> pair

pokey avatar Dec 05 '23 15:12 pokey