diff --git a/packages/app-web-docs/src/docs/user/actions/README.md b/packages/app-web-docs/src/docs/user/actions/README.md new file mode 100644 index 00000000000..bf9020f03df --- /dev/null +++ b/packages/app-web-docs/src/docs/user/actions/README.md @@ -0,0 +1,145 @@ +# Actions + +## Cursor movement + +- [`"take "`](./setSelection.mdx) - Set selection to ``. +- [`"pre "`](./setSelectionBefore.mdx) - Set empty selection before ``. +- [`"post "`](./setSelectionAfter.mdx) - Set empty selection after ``. +- [`"append "`](./addSelection.mdx) - Adds `` to the current selection set. +- [`"append pre "`](./addSelectionBefore.mdx) - Adds empty selection before `` to the current selection set. +- [`"append post "`](./addSelectionAfter.mdx) - Adds empty selection after `` to the current selection set. +- [`"give "`](./deselect.mdx) - Deselect ``. + +## Changing a target + +- [`"change "`](./clearAndSetSelection.mdx) - Change `` by clearing it and leaving the cursor in its place. +- [`"chuck "`](./remove.mdx) - Remove ``. + +## Cut / copy / paste + +- [`"carve "`](./cutToClipboard.mdx) - Cut `` to clipboard. +- [`"copy "`](./copyToClipboard.mdx) - Copy `` to clipboard. +- [`"paste "`](./pasteFromClipboard.mdx) - Paste from clipboard at ``. + +## Insert / use / repeat + +- [`"clone "`](./insertCopyAfter.mdx) - Insert copy after ``. +- [`"clone up "`](./insertCopyBefore.mdx) - Insert copy before ``. +- [`"bring "`](./replaceWithTarget.mdx) - Insert copy of `` at selection. +- [`"bring "`](./replaceWithTarget.mdx) - Copy `` to ``. +- [`"call "`](./callAsFunction.mdx) - Insert call to `` on selection. +- [`"call on "`](./callAsFunction.mdx) - Insert call to `` on ``. + +## Swap + +- [`"swap with "`](./swapTargets.mdx) - Swap selection with ``. +- [`"swap with "`](./swapTargets.mdx) - Swap `` with ``. + +## Move / replace + +- [`"move "`](./moveToTarget.mdx) - Move `` to selection. +- [`"move "`](./moveToTarget.mdx) - Move `` to ``. + +## Indent / outdent + +- [`"indent "`](./indentLine.mdx) - Indent line containing ``. +- [`"dedent "`](./outdentLine.mdx) - Outdent line containing ``. + +## Insert empty lines / scopes + +- [`"drink "`](./editNewLineBefore.mdx) - Edit new line before ``. +- [`"drink "`](./editNewLineBefore.mdx) - Edit new `` before ``. +- [`"pour "`](./editNewLineAfter.mdx) - Edit new line after ``. +- [`"pour "`](./editNewLineAfter.mdx) - Edit new `` after ``. +- [`"drop "`](./insertEmptyLineBefore.mdx) - Insert empty line/scope before ``. +- [`"float "`](./insertEmptyLineAfter.mdx) - Insert empty line/scope after ``. +- [`"puff "`](./insertEmptyLinesAround.mdx) - Insert empty lines/scopes around ``. + +## Reverse / shuffle / sort + +- [`"reverse "`](./reverseTargets.mdx) - Reverse ``s. +- [`"shuffle "`](./randomizeTargets.mdx) - Randomize ``s. +- [`"sort "`](./sortTargets.mdx) - Sort ``s. + +## Wrap / rewrap + +- [`" wrap "`](./wrapWithPairedDelimiter.mdx) - Wrap `` with ``. +- [`" wrap "`](./wrapWithPairedDelimiter.mdx) - Wrap `` with ``. +- [`" repack "`](./rewrapWithPairedDelimiter.mdx) - Rewrap `` with ``. + +## Increment / decrement + +- [`"increment "`](./increment.mdx) - Increment number at ``. +- [`"decrement "`](./decrement.mdx) - Decrement number at ``. + +## Refactor / fix + +- [`"rename "`](./rename.mdx) - Rename ``. +- [`"extract "`](./extractVariable.mdx) - Extract variable from ``. +- [`"quick fix "`](./showQuickFix.mdx) - Show quick fix for ``. + +## Join / break + +- [`"join "`](./joinLines.mdx) - Join lines at ``. +- [`"break "`](./breakLine.mdx) - Breaks the line before ``. + +## Snippets + +- [`"snip make "`](./generateSnippet.mdx) - Generate snippet from ``. +- [`"snip "`](./insertSnippet.mdx) - Insert snippet at ``. + +## Scroll + +- [`"crown "`](./scrollToTop.mdx) - Scroll `` to top of the viewport. +- [`"center "`](./scrollToCenter.mdx) - Scroll `` to center of the viewport. +- [`"bottom "`](./scrollToBottom.mdx) - Scroll `` to bottom of the viewport. + +## Fold / unfold + +- [`"fold "`](./foldRegion.mdx) - Fold region at ``. +- [`"unfold "`](./unfoldRegion.mdx) - Unfold region at ``. + +## Homophones + +- [`"phones "`](./nextHomophone.mdx) - Cycle to next homophone for ``. + +## Format + +- [`"format at "`](./applyFormatter.mdx) - Reformat `` as ``. + +## Instance reference + +- [`"from "`](./setInstanceReference.mdx) - Set instance reference to ``. + +## Comment + +- [`"comment "`](./toggleLineComment.mdx) - Toggle line comment at ``. + +## Breakpoint + +- [`"break point "`](./toggleLineBreakpoint.mdx) - Toggle breakpoint on line containing ``. +- [`"break point token "`](./toggleLineBreakpoint.mdx) - Toggle inline breakpoint at ``. + +## Navigate / inspect + +- [`"define "`](./revealDefinition.mdx) - Reveal definition of ``. +- [`"type deaf "`](./revealTypeDefinition.mdx) - Reveal type definition of ``. +- [`"reference "`](./showReferences.mdx) - Show references for ``. +- [`"hover "`](./showHover.mdx) - Show hover for ``. +- [`"scout "`](./findInDocument.mdx) - Find `` in document. +- [`"scout all "`](./findInWorkspace.mdx) - Find `` in workspace. +- [`"follow "`](./followLink.mdx) - Follow link at ``. +- [`"follow split "`](./followLinkAside.mdx) - Follow link at `` aside (e.g. in a split view). +- [`"inspect "`](./showDebugHover.mdx) - Show debug hover for ``. + +## Git + +- [`"git accept "`](./gitAccept.mdx) - Accept Git change at ``. +- [`"git revert "`](./gitRevert.mdx) - Revert Git change at ``. +- [`"git stage "`](./gitStage.mdx) - Stage Git change at ``. +- [`"git unstage "`](./gitUnstage.mdx) - Unstage Git change at ``. + +## Visual feedback + +- [`"flash "`](./flashTargets.mdx) - Flash ``. +- [`"highlight "`](./highlight.mdx) - Highlight ``. diff --git a/packages/app-web-docs/src/docs/user/modifiers/README.md b/packages/app-web-docs/src/docs/user/modifiers/README.md new file mode 100644 index 00000000000..d5345e2794f --- /dev/null +++ b/packages/app-web-docs/src/docs/user/modifiers/README.md @@ -0,0 +1,63 @@ +# Modifiers + +## Scope containment + +- [`""`](./containingScope.mdx) - Containing instance of ``. +- [`"every "`](./everyScope.mdx) - Every instance of ``. +- [`"grand "`](./ancestor.mdx) - Parent of the containing instance of ``. + +## Ordinal scope + +- [`" "`](./ordinalScope.mdx) - `` instance of `` in iteration scope. +- [`" last "`](./ordinalScope.mdx) - ``-to-last instance of `` in iteration scope. +- [`"first s"`](./ordinalScope.mdx) - First `` instances of `` in iteration scope, as contiguous range. +- [`"every first s"`](./ordinalScope.mdx) - First `` instances of `` in iteration scope, as individual targets. +- [`"last s"`](./ordinalScope.mdx) - Last `` instances of `` in iteration scope, as contiguous range. +- [`"every last s"`](./ordinalScope.mdx) - Last `` instances of `` in iteration scope, as individual targets. + +## Relative scope + +- [`"previous "`](./relativeScope.mdx) - Previous instance of ``. +- [`" previous "`](./relativeScope.mdx) - `` instance of `` before target. +- [`"next "`](./relativeScope.mdx) - Next instance of ``. +- [`" next "`](./relativeScope.mdx) - `` instance of `` after target. +- [`" backward"`](./relativeScope.mdx) - Single instance of `` including target, going backwards. +- [`" forward"`](./relativeScope.mdx) - Single instance of `` including target, going forwards. +- [`" s backward"`](./relativeScope.mdx) - `` instances of `` including target, going backwards, as contiguous range. +- [`"every s backward"`](./relativeScope.mdx) - `` instances of `` including target, going backwards, as individual targets. +- [`" s"`](./relativeScope.mdx) - `` instances of `` including target, going forwards, as contiguous range. +- [`"every s"`](./relativeScope.mdx) - `` instances of `` including target, going forwards, as individual targets. +- [`"previous s"`](./relativeScope.mdx) - Previous `` instances of ``, as contiguous range. +- [`"every previous s"`](./relativeScope.mdx) - Previous `` instances of ``, as individual targets. +- [`"next s"`](./relativeScope.mdx) - Next `` instances of ``, as contiguous range. +- [`"every next s"`](./relativeScope.mdx) - Next `` instances of ``, as individual targets. + +## Interiors / delimiters + +- [`"inside"`](./interiorOnly.mdx) - Interior only. +- [`"bounds"`](./excludeInterior.mdx) - Bounding paired delimiters. +- [`"leading"`](./leading.mdx) - Leading delimiter range. +- [`"trailing"`](./trailing.mdx) - Trailing delimiter range. + +## Range extension + +- [`"head"`](./extendThroughStartOf.mdx) - Extend through start of line/pair. +- [`"head "`](./extendThroughStartOf.mdx) - Extend through start of ``. +- [`"tail"`](./extendThroughEndOf.mdx) - Extend through end of line/pair. +- [`"tail "`](./extendThroughEndOf.mdx) - Extend through end of ``. + +## Positions + +- [`"start of"`](./startOf.mdx) - Empty position at start of target. +- [`"end of"`](./endOf.mdx) - Empty position at end of target. + +## Filters + +- [`"visible"`](./visible.mdx) - Visible in viewport. +- [`"content"`](./keepContentFilter.mdx) - Keep content filter. +- [`"empty"`](./keepEmptyFilter.mdx) - Keep empty filter. + +## Inference + +- [`"just"`](./toRawSelection.mdx) - No inference. +- [`"its"`](./inferPreviousMark.mdx) - Infer previous mark. diff --git a/packages/app-web-docs/src/docs/user/scopes/README.md b/packages/app-web-docs/src/docs/user/scopes/README.md new file mode 100644 index 00000000000..19e6b4ad487 --- /dev/null +++ b/packages/app-web-docs/src/docs/user/scopes/README.md @@ -0,0 +1,89 @@ +# Scopes + +## Text-based scopes + +- [`"char"`](./character.mdx) - Single character within a token. +- [`"sub"`](./word.mdx) - Word-like component within a token, such as part of camelCase or snake_case. +- [`"token"`](./token.mdx) - Token such as a word, number, or operator. +- [`"identifier"`](./identifier.mdx) - Identifier-style sequence, such as camelCase, snake_case, or kebab-case. +- [`"sentence"`](./sentence.mdx) - Text ending at sentence punctuation or a paragraph boundary. +- [`"line"`](./line.mdx) - Line, without indentation. +- [`"full line"`](./fullLine.mdx) - Full line, including indentation. +- [`"block"`](./paragraph.mdx) - Paragraph, contiguous non-empty lines around the target. +- [`"short block"`](./boundedParagraph.mdx) - Paragraph bounded by surrounding pair delimiters. +- [`"file"`](./document.mdx) - Entire document. +- [`"paint"`](./nonWhitespaceSequence.mdx) - Non-whitespace sequence. +- [`"short paint"`](./boundedNonWhitespaceSequence.mdx) - Non-whitespace sequence bounded by surrounding pair delimiters. +- [`"link"`](./url.mdx) - URL / Web address. +- [`""`](./surroundingPair.mdx) - Surrounding matching delimiter pair and its contents. +- [`"glyph "`](./glyph.mdx) - Instance of single character ``. + +## Sections + +- [`"section"`](./section.mdx) - Heading and its content through the next heading of the same or higher level. +- [`"one section"`](./sectionLevelOne.mdx) - Level-one heading and its content. +- [`"two section"`](./sectionLevelTwo.mdx) - Level-two heading and its content. +- [`"three section"`](./sectionLevelThree.mdx) - Level-three heading and its content. +- [`"four section"`](./sectionLevelFour.mdx) - Level-four heading and its content. +- [`"five section"`](./sectionLevelFive.mdx) - Level-five heading and its content. +- [`"six section"`](./sectionLevelSix.mdx) - Level-six heading and its content. + +## Document hierarchy + +- [`"part"`](./part.mdx) - Document part and its contents. +- [`"chapter"`](./chapter.mdx) - Document chapter and its contents. +- [`"subsection"`](./subSection.mdx) - Document subsection and its contents. +- [`"subsubsection"`](./subSubSection.mdx) - Document subsubsection and its contents. +- [`"paragraph"`](./namedParagraph.mdx) - Named document paragraph and its contents. +- [`"subparagraph"`](./subParagraph.mdx) - Document subparagraph and its contents. +- [`"environment"`](./environment.mdx) - Named document environment and its contents. + +## Collections + +- [`"list"`](./list.mdx) - List or array. +- [`"map"`](./map.mdx) - Map, object, or dictionary. +- [`"item"`](./collectionItem.mdx) - Entry in a list, map, object, or similar collection. +- [`"key"`](./collectionKey.mdx) - Key in a map, object, or dictionary. + +## Functions and calls + +- [`"arg"`](./argumentOrParameter.mdx) - Function parameter or function-call argument. +- [`"arg list"`](./argumentList.mdx) - Complete parameter or argument list. +- [`"lambda"`](./anonymousFunction.mdx) - Anonymous or lambda function. +- [`"funk"`](./namedFunction.mdx) - Named function declaration. +- [`"funk name"`](./functionName.mdx) - Name in a function declaration. +- [`"call"`](./functionCall.mdx) - Function, method, or constructor call. +- [`"callee"`](./functionCallee.mdx) - Expression invoked by a function call. + +## Classes and objects + +- [`"class"`](./class.mdx) - Class or struct declaration or definition. +- [`"class name"`](./className.mdx) - Name in a class or struct declaration. +- [`"instance"`](./instance.mdx) - Occurrence matching the current instance. +- [`"name"`](./name.mdx) - Name in a declaration, such as a variable or function name. +- [`"attribute"`](./attribute.mdx) - Attribute, such as one on an HTML element. +- [`"type"`](./type.mdx) - Type annotation or declaration. +- [`"value"`](./value.mdx) - Value in an assignment, collection entry, return statement, or similar construct. + +## Statements and expressions + +- [`"state"`](./statement.mdx) - Complete statement, such as a variable declaration or expression statement. +- [`"branch"`](./branch.mdx) - Branch of a control-flow construct, such as if, try, switch, or ternary. +- [`"if state"`](./ifStatement.mdx) - Complete if statement. +- [`"condition"`](./condition.mdx) - Condition of a conditional, loop, or similar construct. +- [`"comment"`](./comment.mdx) - Line or block comment. +- [`"command"`](./command.mdx) - Command, such as a Talon spoken command or shell command. +- [`"regex"`](./regularExpression.mdx) - Regular-expression literal. + +## Markup and styles + +- [`"element"`](./xmlElement.mdx) - Complete XML, HTML, or JSX element, or a LaTeX environment. +- [`"start tag"`](./xmlStartTag.mdx) - Opening XML, HTML, or JSX tag, or LaTeX `begin` command. +- [`"end tag"`](./xmlEndTag.mdx) - Closing XML, HTML, or JSX tag, or LaTeX `end` command. +- [`"tags"`](./xmlBothTags.mdx) - Opening and closing XML, HTML, or JSX tags, or LaTeX `begin` and `end` commands. +- [`"selector"`](./selector.mdx) - CSS selector. +- [`"unit"`](./unit.mdx) - Unit suffix in a measurement, such as `px` in `100px`. + +## Notebook + +- [`"cell"`](./notebookCell.mdx) - Notebook cell or Markdown fenced code block. diff --git a/packages/app-web-docs/src/docs/user/scopes/anonymousFunction.mdx b/packages/app-web-docs/src/docs/user/scopes/anonymousFunction.mdx index 2a28bbe1fc3..4f079a186c6 100644 --- a/packages/app-web-docs/src/docs/user/scopes/anonymousFunction.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/anonymousFunction.mdx @@ -14,7 +14,7 @@ Default: `lambda` ## Syntax -- lambda - Anonymous function. +- lambda - Anonymous or lambda function. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/argumentList.mdx b/packages/app-web-docs/src/docs/user/scopes/argumentList.mdx index 9c2dcba32b0..b39436bbefa 100644 --- a/packages/app-web-docs/src/docs/user/scopes/argumentList.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/argumentList.mdx @@ -14,7 +14,7 @@ Default: `arg list` ## Syntax -- arg list - Argument list. +- arg list - Complete parameter or argument list. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/argumentOrParameter.mdx b/packages/app-web-docs/src/docs/user/scopes/argumentOrParameter.mdx index 2f429dbcb43..9ec8b10369a 100644 --- a/packages/app-web-docs/src/docs/user/scopes/argumentOrParameter.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/argumentOrParameter.mdx @@ -14,7 +14,7 @@ Default: `arg` ## Syntax -- arg - Argument. +- arg - Function parameter or function-call argument. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/attribute.mdx b/packages/app-web-docs/src/docs/user/scopes/attribute.mdx index f401d8ef1bd..0883f693ae5 100644 --- a/packages/app-web-docs/src/docs/user/scopes/attribute.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/attribute.mdx @@ -14,7 +14,7 @@ Default: `attribute` ## Syntax -- attribute - Attribute. +- attribute - Attribute, such as one on an HTML element. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/branch.mdx b/packages/app-web-docs/src/docs/user/scopes/branch.mdx index 3d11545bee6..fb6554f2948 100644 --- a/packages/app-web-docs/src/docs/user/scopes/branch.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/branch.mdx @@ -14,7 +14,7 @@ Default: `branch` ## Syntax -- branch - Branch. +- branch - Branch of a control-flow construct, such as if, try, switch, or ternary. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/chapter.mdx b/packages/app-web-docs/src/docs/user/scopes/chapter.mdx index 1de3c9ebd08..73665b30b38 100644 --- a/packages/app-web-docs/src/docs/user/scopes/chapter.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/chapter.mdx @@ -14,7 +14,7 @@ Default: `chapter` ## Syntax -- chapter - Chapter. +- chapter - Document chapter and its contents. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/character.mdx b/packages/app-web-docs/src/docs/user/scopes/character.mdx index f0b6ce80974..76077f663cd 100644 --- a/packages/app-web-docs/src/docs/user/scopes/character.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/character.mdx @@ -14,7 +14,7 @@ Default: `char` ## Syntax -- char - Character. +- char - Single character within a token. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/class.mdx b/packages/app-web-docs/src/docs/user/scopes/class.mdx index ae7216cdac6..4f6022be2f3 100644 --- a/packages/app-web-docs/src/docs/user/scopes/class.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/class.mdx @@ -14,7 +14,7 @@ Default: `class` ## Syntax -- class - Class. +- class - Class or struct declaration or definition. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/className.mdx b/packages/app-web-docs/src/docs/user/scopes/className.mdx index 523f51c27ef..528125bae02 100644 --- a/packages/app-web-docs/src/docs/user/scopes/className.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/className.mdx @@ -14,7 +14,7 @@ Default: `class name` ## Syntax -- class name - Class name. +- class name - Name in a class or struct declaration. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/collectionItem.mdx b/packages/app-web-docs/src/docs/user/scopes/collectionItem.mdx index 79640a0c1b0..91965692d33 100644 --- a/packages/app-web-docs/src/docs/user/scopes/collectionItem.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/collectionItem.mdx @@ -14,7 +14,7 @@ Default: `item` ## Syntax -- item - Collection item. +- item - Entry in a list, map, object, or similar collection. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/collectionKey.mdx b/packages/app-web-docs/src/docs/user/scopes/collectionKey.mdx index b29d9f85d7e..e9070e090ba 100644 --- a/packages/app-web-docs/src/docs/user/scopes/collectionKey.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/collectionKey.mdx @@ -14,7 +14,7 @@ Default: `key` ## Syntax -- key - Collection key. +- key - Key in a map, object, or dictionary. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/command.mdx b/packages/app-web-docs/src/docs/user/scopes/command.mdx index fde19985857..62d0089222e 100644 --- a/packages/app-web-docs/src/docs/user/scopes/command.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/command.mdx @@ -14,7 +14,7 @@ Default: `command` ## Syntax -- command - Command. +- command - Command, such as a Talon spoken command or shell command. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/comment.mdx b/packages/app-web-docs/src/docs/user/scopes/comment.mdx index cf80f9992eb..be6c916498a 100644 --- a/packages/app-web-docs/src/docs/user/scopes/comment.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/comment.mdx @@ -14,7 +14,7 @@ Default: `comment` ## Syntax -- comment - Comment. +- comment - Line or block comment. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/condition.mdx b/packages/app-web-docs/src/docs/user/scopes/condition.mdx index 94ea4e59751..936d3997419 100644 --- a/packages/app-web-docs/src/docs/user/scopes/condition.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/condition.mdx @@ -14,7 +14,7 @@ Default: `condition` ## Syntax -- condition - Condition. +- condition - Condition of a conditional, loop, or similar construct. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/document.mdx b/packages/app-web-docs/src/docs/user/scopes/document.mdx index 7c7caea7b0a..e9c7309bbd1 100644 --- a/packages/app-web-docs/src/docs/user/scopes/document.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/document.mdx @@ -14,7 +14,7 @@ Default: `file` ## Syntax -- file - Document. +- file - Entire document. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/environment.mdx b/packages/app-web-docs/src/docs/user/scopes/environment.mdx index 862ed10cc69..8083352037b 100644 --- a/packages/app-web-docs/src/docs/user/scopes/environment.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/environment.mdx @@ -14,7 +14,7 @@ Default: `environment` ## Syntax -- environment - Environment. +- environment - Named document environment and its contents. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/fullLine.mdx b/packages/app-web-docs/src/docs/user/scopes/fullLine.mdx index 42680c2a93f..a3f665459e2 100644 --- a/packages/app-web-docs/src/docs/user/scopes/fullLine.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/fullLine.mdx @@ -14,7 +14,7 @@ Default: `full line` ## Syntax -- full line - Full line. +- full line - Full line, including indentation. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/functionCall.mdx b/packages/app-web-docs/src/docs/user/scopes/functionCall.mdx index 6878505acbf..cff994ddc2c 100644 --- a/packages/app-web-docs/src/docs/user/scopes/functionCall.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/functionCall.mdx @@ -14,7 +14,7 @@ Default: `call` ## Syntax -- call - Function call. +- call - Function, method, or constructor call. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/functionCallee.mdx b/packages/app-web-docs/src/docs/user/scopes/functionCallee.mdx index d2cc69924df..568b09a60c4 100644 --- a/packages/app-web-docs/src/docs/user/scopes/functionCallee.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/functionCallee.mdx @@ -14,7 +14,7 @@ Default: `callee` ## Syntax -- callee - Function callee. +- callee - Expression invoked by a function call. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/functionName.mdx b/packages/app-web-docs/src/docs/user/scopes/functionName.mdx index 1ee578949e9..d884b52efce 100644 --- a/packages/app-web-docs/src/docs/user/scopes/functionName.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/functionName.mdx @@ -14,7 +14,7 @@ Default: `funk name` ## Syntax -- funk name - Function name. +- funk name - Name in a function declaration. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/identifier.mdx b/packages/app-web-docs/src/docs/user/scopes/identifier.mdx index cf2cabb1a0e..830ee6958ff 100644 --- a/packages/app-web-docs/src/docs/user/scopes/identifier.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/identifier.mdx @@ -14,7 +14,7 @@ Default: `identifier` ## Syntax -- identifier - Identifier. +- identifier - Identifier-style sequence, such as camelCase, snake_case, or kebab-case. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/ifStatement.mdx b/packages/app-web-docs/src/docs/user/scopes/ifStatement.mdx index 883ec027d22..d4f7bbe84c0 100644 --- a/packages/app-web-docs/src/docs/user/scopes/ifStatement.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/ifStatement.mdx @@ -14,7 +14,7 @@ Default: `if state` ## Syntax -- if state - If statement. +- if state - Complete if statement. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/instance.mdx b/packages/app-web-docs/src/docs/user/scopes/instance.mdx index db251ec24b2..86aad769c30 100644 --- a/packages/app-web-docs/src/docs/user/scopes/instance.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/instance.mdx @@ -14,7 +14,7 @@ Default: `instance` ## Syntax -- instance - Instance. +- instance - Occurrence matching the current instance. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/line.mdx b/packages/app-web-docs/src/docs/user/scopes/line.mdx index 2037ec188e9..ea6c1a6faaa 100644 --- a/packages/app-web-docs/src/docs/user/scopes/line.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/line.mdx @@ -14,7 +14,7 @@ Default: `line` ## Syntax -- line - Line. +- line - Line, without indentation. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/list.mdx b/packages/app-web-docs/src/docs/user/scopes/list.mdx index 384e5edc008..362e879c2f3 100644 --- a/packages/app-web-docs/src/docs/user/scopes/list.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/list.mdx @@ -14,7 +14,7 @@ Default: `list` ## Syntax -- list - List. +- list - List or array. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/map.mdx b/packages/app-web-docs/src/docs/user/scopes/map.mdx index d0c5985bf6c..b6da3855d87 100644 --- a/packages/app-web-docs/src/docs/user/scopes/map.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/map.mdx @@ -14,7 +14,7 @@ Default: `map` ## Syntax -- map - Map. +- map - Map, object, or dictionary. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/name.mdx b/packages/app-web-docs/src/docs/user/scopes/name.mdx index d2f5d9fc9c8..39c36aa4ce7 100644 --- a/packages/app-web-docs/src/docs/user/scopes/name.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/name.mdx @@ -14,7 +14,7 @@ Default: `name` ## Syntax -- name - Name. +- name - Name in a declaration, such as a variable or function name. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/namedFunction.mdx b/packages/app-web-docs/src/docs/user/scopes/namedFunction.mdx index 5012903ab76..4ae0f275d3d 100644 --- a/packages/app-web-docs/src/docs/user/scopes/namedFunction.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/namedFunction.mdx @@ -14,7 +14,7 @@ Default: `funk` ## Syntax -- funk - Named function. +- funk - Named function declaration. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/namedParagraph.mdx b/packages/app-web-docs/src/docs/user/scopes/namedParagraph.mdx index 8396f232ae0..55afe80ba5e 100644 --- a/packages/app-web-docs/src/docs/user/scopes/namedParagraph.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/namedParagraph.mdx @@ -14,7 +14,7 @@ Default: `paragraph` ## Syntax -- paragraph - Named paragraph. +- paragraph - Named document paragraph and its contents. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/notebookCell.mdx b/packages/app-web-docs/src/docs/user/scopes/notebookCell.mdx index 497ceb816e3..3be71e4309d 100644 --- a/packages/app-web-docs/src/docs/user/scopes/notebookCell.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/notebookCell.mdx @@ -14,7 +14,7 @@ Default: `cell` ## Syntax -- cell - Notebook cell. +- cell - Notebook cell or Markdown fenced code block. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/paragraph.mdx b/packages/app-web-docs/src/docs/user/scopes/paragraph.mdx index 30abc74d013..9f77c3e3933 100644 --- a/packages/app-web-docs/src/docs/user/scopes/paragraph.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/paragraph.mdx @@ -14,7 +14,7 @@ Default: `block` ## Syntax -- block - Paragraph. +- block - Paragraph, contiguous non-empty lines around the target. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/part.mdx b/packages/app-web-docs/src/docs/user/scopes/part.mdx index 5640eac56cb..322db0d0fca 100644 --- a/packages/app-web-docs/src/docs/user/scopes/part.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/part.mdx @@ -14,7 +14,7 @@ Default: `part` ## Syntax -- part - Part. +- part - Document part and its contents. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/regularExpression.mdx b/packages/app-web-docs/src/docs/user/scopes/regularExpression.mdx index d10fd190fad..3c15712adf7 100644 --- a/packages/app-web-docs/src/docs/user/scopes/regularExpression.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/regularExpression.mdx @@ -14,7 +14,7 @@ Default: `regex` ## Syntax -- regex - Regular expression. +- regex - Regular-expression literal. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/section.mdx b/packages/app-web-docs/src/docs/user/scopes/section.mdx index 9ff05e90da9..c8d4e76295b 100644 --- a/packages/app-web-docs/src/docs/user/scopes/section.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/section.mdx @@ -14,7 +14,7 @@ Default: `section` ## Syntax -- section - Section. +- section - Heading and its content through the next heading of the same or higher level. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/sectionLevelFive.mdx b/packages/app-web-docs/src/docs/user/scopes/sectionLevelFive.mdx index 96d159bb0d8..f0bc7e49c3f 100644 --- a/packages/app-web-docs/src/docs/user/scopes/sectionLevelFive.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/sectionLevelFive.mdx @@ -15,7 +15,7 @@ Default: `five section`\ ## Syntax -- five section - Section level five. +- five section - Level-five heading and its content. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/sectionLevelFour.mdx b/packages/app-web-docs/src/docs/user/scopes/sectionLevelFour.mdx index 0b0a25d0c1f..24ebf154266 100644 --- a/packages/app-web-docs/src/docs/user/scopes/sectionLevelFour.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/sectionLevelFour.mdx @@ -15,7 +15,7 @@ Default: `four section`\ ## Syntax -- four section - Section level four. +- four section - Level-four heading and its content. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/sectionLevelOne.mdx b/packages/app-web-docs/src/docs/user/scopes/sectionLevelOne.mdx index b01ddff4544..de34f5c132d 100644 --- a/packages/app-web-docs/src/docs/user/scopes/sectionLevelOne.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/sectionLevelOne.mdx @@ -15,7 +15,7 @@ Default: `one section`\ ## Syntax -- one section - Section level one. +- one section - Level-one heading and its content. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/sectionLevelSix.mdx b/packages/app-web-docs/src/docs/user/scopes/sectionLevelSix.mdx index 74a361306d3..4657c14d6cb 100644 --- a/packages/app-web-docs/src/docs/user/scopes/sectionLevelSix.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/sectionLevelSix.mdx @@ -15,7 +15,7 @@ Default: `six section`\ ## Syntax -- six section - Section level six. +- six section - Level-six heading and its content. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/sectionLevelThree.mdx b/packages/app-web-docs/src/docs/user/scopes/sectionLevelThree.mdx index 3195801b360..8a6d26e1859 100644 --- a/packages/app-web-docs/src/docs/user/scopes/sectionLevelThree.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/sectionLevelThree.mdx @@ -15,7 +15,7 @@ Default: `three section`\ ## Syntax -- three section - Section level three. +- three section - Level-three heading and its content. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/sectionLevelTwo.mdx b/packages/app-web-docs/src/docs/user/scopes/sectionLevelTwo.mdx index efdf17e0e7a..8fe88e3c175 100644 --- a/packages/app-web-docs/src/docs/user/scopes/sectionLevelTwo.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/sectionLevelTwo.mdx @@ -15,7 +15,7 @@ Default: `two section`\ ## Syntax -- two section - Section level two. +- two section - Level-two heading and its content. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/selector.mdx b/packages/app-web-docs/src/docs/user/scopes/selector.mdx index de1707e7f3e..6e1e7ec59e4 100644 --- a/packages/app-web-docs/src/docs/user/scopes/selector.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/selector.mdx @@ -14,7 +14,7 @@ Default: `selector` ## Syntax -- selector - Selector. +- selector - CSS selector. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/sentence.mdx b/packages/app-web-docs/src/docs/user/scopes/sentence.mdx index eb2d297281b..775011df5af 100644 --- a/packages/app-web-docs/src/docs/user/scopes/sentence.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/sentence.mdx @@ -14,7 +14,7 @@ Default: `sentence` ## Syntax -- sentence - Sentence. +- sentence - Text ending at sentence punctuation or a paragraph boundary. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/statement.mdx b/packages/app-web-docs/src/docs/user/scopes/statement.mdx index a36cbd9cf31..63eecf47996 100644 --- a/packages/app-web-docs/src/docs/user/scopes/statement.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/statement.mdx @@ -14,7 +14,7 @@ Default: `state` ## Syntax -- state - Statement. +- state - Complete statement, such as a variable declaration or expression statement. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/subParagraph.mdx b/packages/app-web-docs/src/docs/user/scopes/subParagraph.mdx index c9ac4a046f9..1d6ff474ae3 100644 --- a/packages/app-web-docs/src/docs/user/scopes/subParagraph.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/subParagraph.mdx @@ -14,7 +14,7 @@ Default: `subparagraph` ## Syntax -- subparagraph - Subparagraph. +- subparagraph - Document subparagraph and its contents. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/subSection.mdx b/packages/app-web-docs/src/docs/user/scopes/subSection.mdx index 5f4109fac90..6796f651c26 100644 --- a/packages/app-web-docs/src/docs/user/scopes/subSection.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/subSection.mdx @@ -14,7 +14,7 @@ Default: `subsection` ## Syntax -- subsection - Subsection. +- subsection - Document subsection and its contents. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/subSubSection.mdx b/packages/app-web-docs/src/docs/user/scopes/subSubSection.mdx index 9a3713e9e46..c6900f121c2 100644 --- a/packages/app-web-docs/src/docs/user/scopes/subSubSection.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/subSubSection.mdx @@ -14,7 +14,7 @@ Default: `subsubsection` ## Syntax -- subsubsection - Subsubsection. +- subsubsection - Document subsubsection and its contents. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/surroundingPair.mdx b/packages/app-web-docs/src/docs/user/scopes/surroundingPair.mdx index e0c67316be7..a7da0927b53 100644 --- a/packages/app-web-docs/src/docs/user/scopes/surroundingPair.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/surroundingPair.mdx @@ -6,7 +6,7 @@ Cursorless ID: `surroundingPair` ## Syntax -- `` - Surrounding pair. +- `` - Surrounding matching delimiter pair and its contents. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/token.mdx b/packages/app-web-docs/src/docs/user/scopes/token.mdx index 30b4c439502..4d90f074ef6 100644 --- a/packages/app-web-docs/src/docs/user/scopes/token.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/token.mdx @@ -14,7 +14,7 @@ Default: `token` ## Syntax -- token - Token. +- token - Token such as a word, number, or operator. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/type.mdx b/packages/app-web-docs/src/docs/user/scopes/type.mdx index 34c1e718200..700e0624992 100644 --- a/packages/app-web-docs/src/docs/user/scopes/type.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/type.mdx @@ -14,7 +14,7 @@ Default: `type` ## Syntax -- type - Type. +- type - Type annotation or declaration. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/unit.mdx b/packages/app-web-docs/src/docs/user/scopes/unit.mdx index 0591fc1394d..ec021debbd3 100644 --- a/packages/app-web-docs/src/docs/user/scopes/unit.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/unit.mdx @@ -14,7 +14,7 @@ Default: `unit` ## Syntax -- unit - Unit. +- unit - Unit suffix in a measurement, such as `px` in `100px`. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/url.mdx b/packages/app-web-docs/src/docs/user/scopes/url.mdx index 075752550d0..77b2c7c01f7 100644 --- a/packages/app-web-docs/src/docs/user/scopes/url.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/url.mdx @@ -14,7 +14,7 @@ Default: `link` ## Syntax -- link - URL. +- link - URL / Web address. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/value.mdx b/packages/app-web-docs/src/docs/user/scopes/value.mdx index f94b28fdd94..8d3f3370882 100644 --- a/packages/app-web-docs/src/docs/user/scopes/value.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/value.mdx @@ -14,7 +14,7 @@ Default: `value` ## Syntax -- value - Value. +- value - Value in an assignment, collection entry, return statement, or similar construct. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/word.mdx b/packages/app-web-docs/src/docs/user/scopes/word.mdx index 827adab844f..da48599e052 100644 --- a/packages/app-web-docs/src/docs/user/scopes/word.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/word.mdx @@ -15,7 +15,7 @@ Legacy: `word` ## Syntax -- sub - Sub token word. +- sub - Word-like component within a token, such as part of camelCase or snake_case. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/xmlBothTags.mdx b/packages/app-web-docs/src/docs/user/scopes/xmlBothTags.mdx index 224a3b4abbb..61624b5d4c0 100644 --- a/packages/app-web-docs/src/docs/user/scopes/xmlBothTags.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/xmlBothTags.mdx @@ -14,7 +14,7 @@ Default: `tags` ## Syntax -- tags - XML start and end tags. +- tags - Opening and closing XML, HTML, or JSX tags, or LaTeX `begin` and `end` commands. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/xmlElement.mdx b/packages/app-web-docs/src/docs/user/scopes/xmlElement.mdx index 1dcebbcaec9..99cdcfcff3b 100644 --- a/packages/app-web-docs/src/docs/user/scopes/xmlElement.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/xmlElement.mdx @@ -14,7 +14,7 @@ Default: `element` ## Syntax -- element - XML element. +- element - Complete XML, HTML, or JSX element, or a LaTeX environment. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/xmlEndTag.mdx b/packages/app-web-docs/src/docs/user/scopes/xmlEndTag.mdx index cf716936963..72248b7b17d 100644 --- a/packages/app-web-docs/src/docs/user/scopes/xmlEndTag.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/xmlEndTag.mdx @@ -14,7 +14,7 @@ Default: `end tag` ## Syntax -- end tag - XML end tag. +- end tag - Closing XML, HTML, or JSX tag, or LaTeX `end` command. ## Examples diff --git a/packages/app-web-docs/src/docs/user/scopes/xmlStartTag.mdx b/packages/app-web-docs/src/docs/user/scopes/xmlStartTag.mdx index 789a03a6caf..56600039feb 100644 --- a/packages/app-web-docs/src/docs/user/scopes/xmlStartTag.mdx +++ b/packages/app-web-docs/src/docs/user/scopes/xmlStartTag.mdx @@ -14,7 +14,7 @@ Default: `start tag` ## Syntax -- start tag - XML start tag. +- start tag - Opening XML, HTML, or JSX tag, or LaTeX `begin` command. ## Examples diff --git a/packages/lib-common/src/references/ReferenceEntry.ts b/packages/lib-common/src/references/ReferenceEntry.ts index fb44632f761..bb1d09d6273 100644 --- a/packages/lib-common/src/references/ReferenceEntry.ts +++ b/packages/lib-common/src/references/ReferenceEntry.ts @@ -4,15 +4,25 @@ export interface SpokenFormReference { disabledByDefault?: boolean; } -export interface ReferenceEntry extends SpokenFormReference { +export interface ReferenceEntry extends SpokenFormReference { name: string; - nameShort?: string; legacySpokenForms?: string[]; description?: string; + group: GroupDefinition; syntaxes: SyntaxDefinition[]; examples: ExampleDefinition[]; } +export interface ReferenceGroup { + id: T; + name: string; +} + +interface GroupDefinition { + id: T; + index: number; +} + interface SyntaxDefinition { pattern: string; description: string; diff --git a/packages/lib-common/src/references/actionReferenceGroups.ts b/packages/lib-common/src/references/actionReferenceGroups.ts new file mode 100644 index 00000000000..ba324845f56 --- /dev/null +++ b/packages/lib-common/src/references/actionReferenceGroups.ts @@ -0,0 +1,127 @@ +import type { ReferenceGroup } from "./ReferenceEntry"; + +export type ActionReferenceGroupId = + | "cursor" + | "change" + | "clipboard" + | "swap" + | "indentation" + | "numbers" + | "emptyLines" + | "homophones" + | "scroll" + | "insert" + | "move" + | "reorder" + | "wrap" + | "navigation" + | "folding" + | "refactor" + | "joinBreak" + | "visual" + | "snippets" + | "git" + | "format" + | "comment" + | "breakpoint" + | "instanceReference" + | "private"; + +export const actionReferenceGroups: ReferenceGroup[] = [ + { + id: "cursor", + name: "Cursor movement", + }, + { + id: "change", + name: "Changing a target", + }, + { + id: "clipboard", + name: "Cut / copy / paste", + }, + { + id: "insert", + name: "Insert / use / repeat", + }, + { + id: "swap", + name: "Swap", + }, + { + id: "move", + name: "Move / replace", + }, + { + id: "indentation", + name: "Indent / outdent", + }, + { + id: "emptyLines", + name: "Insert empty lines / scopes", + }, + { + id: "reorder", + name: "Reverse / shuffle / sort", + }, + { + id: "wrap", + name: "Wrap / rewrap", + }, + { + id: "numbers", + name: "Increment / decrement", + }, + { + id: "refactor", + name: "Refactor / fix", + }, + { + id: "joinBreak", + name: "Join / break", + }, + { + id: "snippets", + name: "Snippets", + }, + { + id: "scroll", + name: "Scroll", + }, + { + id: "folding", + name: "Fold / unfold", + }, + { + id: "homophones", + name: "Homophones", + }, + { + id: "format", + name: "Format", + }, + { + id: "instanceReference", + name: "Instance reference", + }, + { + id: "comment", + name: "Comment", + }, + { + id: "breakpoint", + name: "Breakpoint", + }, + { + id: "navigation", + name: "Navigate / inspect", + }, + { + id: "git", + name: "Git", + }, + { + id: "visual", + name: "Visual feedback", + }, +]; diff --git a/packages/lib-common/src/references/actionReferences.ts b/packages/lib-common/src/references/actionReferences.ts index 93285004f5a..7a62f7f044f 100644 --- a/packages/lib-common/src/references/actionReferences.ts +++ b/packages/lib-common/src/references/actionReferences.ts @@ -1,4 +1,5 @@ import type { ActionType } from "../types/command/ActionDescriptor"; +import type { ActionReferenceGroupId } from "./actionReferenceGroups"; import { FORMATTER_CAMEL, REMOVE, @@ -46,512 +47,480 @@ const ON = connectiveDefaultSpokenForms.on; type TalonSideActionType = "applyFormatter" | "nextHomophone"; export const actionReferences = { - addSelection: { - name: "Add selection", - defaultSpokenForm: "append", + // Group: cursor + setSelection: { + name: "Set selection", + defaultSpokenForm: SET_SELECTION, + group: { id: "cursor", index: 0 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Adds ${VAR_TARGET} to the current selection set.`, - cheatsheet: "Add selection", + description: `Set selection to ${VAR_TARGET}.`, + cheatsheet: "Set selection", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Adds the ${TARGET_DESC} to the current selections.`, + description: `Selects the ${TARGET_DESC}.`, }, ], }, - addSelectionAfter: { - name: "Add selection after", - defaultSpokenForm: "append post", + setSelectionBefore: { + name: "Set selection before", + defaultSpokenForm: "pre", + group: { id: "cursor", index: 1 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Adds empty selection after ${VAR_TARGET} to the current selection set.`, - cheatsheet: "Add selection after", + description: `Set empty selection before ${VAR_TARGET}.`, + cheatsheet: "Set selection before", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Adds an empty selection after the ${TARGET_DESC}.`, + description: `Places the cursor before the ${TARGET_DESC}.`, }, ], }, - addSelectionBefore: { - name: "Add selection before", - defaultSpokenForm: "append pre", + setSelectionAfter: { + name: "Set selection after", + defaultSpokenForm: "post", + group: { id: "cursor", index: 2 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Adds empty selection before ${VAR_TARGET} to the current selection set.`, - cheatsheet: "Add selection before", + description: `Set empty selection after ${VAR_TARGET}.`, + cheatsheet: "Set selection after", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Adds an empty selection before the ${TARGET_DESC}.`, + description: `Places the cursor after the ${TARGET_DESC}.`, }, ], }, - breakLine: { - name: "Break line", - defaultSpokenForm: "break", + addSelection: { + name: "Add selection", + defaultSpokenForm: "append", + group: { id: "cursor", index: 3 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Breaks the line before ${VAR_TARGET}.`, - cheatsheet: "Breaks the line", + description: `Adds ${VAR_TARGET} to the current selection set.`, + cheatsheet: "Add selection", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Breaks the line before the ${TARGET_DESC}.`, + description: `Adds the ${TARGET_DESC} to the current selections.`, }, ], }, - clearAndSetSelection: { - name: "Change", - defaultSpokenForm: "change", - legacySpokenForms: ["clear"], + addSelectionBefore: { + name: "Add selection before", + defaultSpokenForm: "append pre", + group: { id: "cursor", index: 4 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Change ${VAR_TARGET} by clearing it and leaving the cursor in its place.`, - cheatsheet: "Change", + description: `Adds empty selection before ${VAR_TARGET} to the current selection set.`, + cheatsheet: "Add selection before", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Changes the ${TARGET_DESC} by clearing it and leaving the cursor in its place.`, + description: `Adds an empty selection before the ${TARGET_DESC}.`, }, ], }, - copyToClipboard: { - name: "Copy to clipboard", - defaultSpokenForm: "copy", + addSelectionAfter: { + name: "Add selection after", + defaultSpokenForm: "append post", + group: { id: "cursor", index: 5 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Copy ${VAR_TARGET} to clipboard.`, - cheatsheet: "Copy to clipboard", + description: `Adds empty selection after ${VAR_TARGET} to the current selection set.`, + cheatsheet: "Add selection after", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Copies the ${TARGET_DESC} to the clipboard.`, + description: `Adds an empty selection after the ${TARGET_DESC}.`, }, ], }, - cutToClipboard: { - name: "Cut to clipboard", - defaultSpokenForm: "carve", + deselect: { + name: "Deselect", + defaultSpokenForm: "give", + group: { id: "cursor", index: 6 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Cut ${VAR_TARGET} to clipboard.`, - cheatsheet: "Cut to clipboard", + description: `Deselect ${VAR_TARGET}.`, + cheatsheet: "Deselect", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Cuts the ${TARGET_DESC} to the clipboard.`, + description: `Removes the ${TARGET_DESC} from the current selections.`, }, ], }, - decrement: { - name: "Decrement", - defaultSpokenForm: "decrement", + + // Group: change + clearAndSetSelection: { + name: "Change", + defaultSpokenForm: "change", + group: { id: "change", index: 0 }, + legacySpokenForms: ["clear"], syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Decrement number at ${VAR_TARGET}.`, - cheatsheet: "Decrement number", + description: `Change ${VAR_TARGET} by clearing it and leaving the cursor in its place.`, + cheatsheet: "Change", }, ], examples: [ { - command: `${VAR_SPOKEN_FORM} ${TARGET_NUMBER}`, - description: `Decrements the number at the ${TARGET_NUMBER_DESC}.`, + command: DEFAULT_COMMAND, + description: `Changes the ${TARGET_DESC} by clearing it and leaving the cursor in its place.`, }, ], }, - deselect: { - name: "Deselect", - defaultSpokenForm: "give", + remove: { + name: "Remove", + defaultSpokenForm: REMOVE, + group: { id: "change", index: 1 }, + description: + "This action can be used to remove a target without moving the cursor.", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Deselect ${VAR_TARGET}.`, - cheatsheet: "Deselect", + description: `Remove ${VAR_TARGET}.`, + cheatsheet: "Remove", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Removes the ${TARGET_DESC} from the current selections.`, + description: `Removes the ${TARGET_DESC}.`, }, ], }, - editNewLineAfter: { - name: "Edit new line/scope after", - defaultSpokenForm: "pour", - description: "Scope defaults to line.", + + // Group: clipboard + cutToClipboard: { + name: "Cut to clipboard", + defaultSpokenForm: "carve", + group: { id: "clipboard", index: 0 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Edit new line after ${VAR_TARGET}.`, - cheatsheet: "Edit new line after", - }, - { - pattern: `${VAR_SPOKEN_FORM} ${VAR_SCOPE} ${VAR_TARGET}`, - description: `Edit new ${VAR_SCOPE} after ${VAR_TARGET}.`, - cheatsheet: `Edit new ${VAR_SCOPE} after`, + description: `Cut ${VAR_TARGET} to clipboard.`, + cheatsheet: "Cut to clipboard", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Inserts a new line below the ${TARGET_DESC} and moves the cursor to it.`, - }, - { - command: `${VAR_SPOKEN_FORM} ${ITEM} ${TARGET}`, - description: `Inserts the delimiters for a new collection item after the item containing the ${TARGET_DESC} and moves the cursor there.`, + description: `Cuts the ${TARGET_DESC} to the clipboard.`, }, ], }, - editNewLineBefore: { - name: "Edit new line/scope before", - defaultSpokenForm: "drink", - description: "Scope defaults to line.", + copyToClipboard: { + name: "Copy to clipboard", + defaultSpokenForm: "copy", + group: { id: "clipboard", index: 1 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Edit new line before ${VAR_TARGET}.`, - cheatsheet: "Edit new line before", - }, - { - pattern: `${VAR_SPOKEN_FORM} ${VAR_SCOPE} ${VAR_TARGET}`, - description: `Edit new ${VAR_SCOPE} before ${VAR_TARGET}.`, - cheatsheet: `Edit new ${VAR_SCOPE} before`, + description: `Copy ${VAR_TARGET} to clipboard.`, + cheatsheet: "Copy to clipboard", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Inserts a new line above the ${TARGET_DESC} and moves the cursor to it.`, - }, - { - command: `${VAR_SPOKEN_FORM} ${ITEM} ${TARGET}`, - description: `Inserts the delimiters for a new collection item before the item containing the ${TARGET_DESC} and moves the cursor there.`, + description: `Copies the ${TARGET_DESC} to the clipboard.`, }, ], }, - "experimental.setInstanceReference": { - name: "Set instance reference", - defaultSpokenForm: "from", - description: - "Sets the instance reference for the next 'instance of' action.", + pasteFromClipboard: { + name: "Paste from clipboard", + defaultSpokenForm: "paste", + group: { id: "clipboard", index: 2 }, syntaxes: [ { - pattern: DEFAULT_PATTERN, - description: `Set instance reference to ${VAR_TARGET}.`, - cheatsheet: "Set instance reference", + pattern: `${VAR_SPOKEN_FORM} ${VAR_DESTINATION}`, + description: `Paste from clipboard at ${VAR_DESTINATION}.`, + cheatsheet: `Paste from clipboard at ${VAR_DESTINATION}`, }, ], examples: [ { - command: `${VAR_SPOKEN_FORM} ${FUNCTION} ${TARGET} ${SET_SELECTION} ${EVERY} ${INSTANCE} ${TARGET_2}`, - description: `Selects every instance of the ${TARGET_2_DESC} within the function containing the ${TARGET_DESC}.`, + command: `${VAR_SPOKEN_FORM} ${AFTER} ${TARGET}`, + description: `Pastes the clipboard contents after the ${TARGET_DESC}.`, }, ], }, - extractVariable: { - name: "Extract variable", - defaultSpokenForm: "extract", + + // Group: insert + insertCopyAfter: { + name: "Insert copy after", + defaultSpokenForm: "clone", + group: { id: "insert", index: 0 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Extract variable from ${VAR_TARGET}.`, - cheatsheet: "Extract variable", + description: `Insert copy after ${VAR_TARGET}.`, + cheatsheet: "Insert copy after", }, ], examples: [ { - command: `${VAR_SPOKEN_FORM} ${VALUE} ${TARGET}`, - description: `Extracts the value containing the ${TARGET_DESC} into a variable.`, + command: `${VAR_SPOKEN_FORM} ${FUNCTION} ${TARGET}`, + description: `Inserts a copy of the function containing the ${TARGET_DESC} after itself.`, }, ], }, - findInDocument: { - name: "Find in document", - defaultSpokenForm: "scout", + insertCopyBefore: { + name: "Insert copy before", + defaultSpokenForm: "clone up", + group: { id: "insert", index: 1 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Find ${VAR_TARGET} in document.`, - cheatsheet: "Find in document", + description: `Insert copy before ${VAR_TARGET}.`, + cheatsheet: "Insert copy before", }, ], examples: [ { - command: DEFAULT_COMMAND, - description: `Searches the current document for the ${TARGET_DESC}.`, + command: `${VAR_SPOKEN_FORM} ${FUNCTION} ${TARGET}`, + description: `Inserts a copy of the function containing the ${TARGET_DESC} before itself.`, }, ], }, - findInWorkspace: { - name: "Find in workspace", - defaultSpokenForm: "scout all", + replaceWithTarget: { + name: "Replace with target", + defaultSpokenForm: "bring", + group: { id: "insert", index: 2 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Find ${VAR_TARGET} in workspace.`, - cheatsheet: "Find in workspace", + description: `Insert copy of ${VAR_TARGET} at selection.`, + cheatsheet: `Insert copy of ${VAR_TARGET} at selection`, + }, + { + pattern: `${VAR_SPOKEN_FORM} ${VAR_TARGET} ${VAR_DESTINATION}`, + description: `Copy ${VAR_TARGET} to ${VAR_DESTINATION}.`, + cheatsheet: `Copy ${VAR_TARGET} to ${VAR_DESTINATION}`, }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Searches the workspace for the ${TARGET_DESC}.`, + description: `Inserts a copy of the ${TARGET_DESC} at the current selection.`, + }, + { + command: `${VAR_SPOKEN_FORM} ${TARGET} ${TO} ${TARGET_2}`, + description: `Replaces the ${TARGET_2_DESC} with a copy of the ${TARGET_DESC}.`, }, ], }, - flashTargets: { - name: "Flash target", - defaultSpokenForm: "flash", + callAsFunction: { + name: "Call as function", + defaultSpokenForm: "call", + group: { id: "insert", index: 3 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Flash ${VAR_TARGET}.`, - cheatsheet: "Flash target", + description: `Insert call to ${VAR_TARGET} on selection.`, + cheatsheet: `Insert call to ${VAR_TARGET} on selection`, + }, + { + pattern: `${VAR_SPOKEN_FORM} ${VAR_TARGET_1} ${ON} ${VAR_TARGET_2}`, + description: `Insert call to ${VAR_TARGET_1} on ${VAR_TARGET_2}.`, + cheatsheet: `Insert call to ${VAR_TARGET_1} on ${VAR_TARGET_2}`, }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Briefly flashes the ${TARGET_DESC}.`, + description: `Inserts a call to the ${TARGET_DESC} at the current selection.`, + }, + { + command: `${VAR_SPOKEN_FORM} ${TARGET} ${ON} ${TARGET_2}`, + description: `Inserts a call to the ${TARGET_DESC} on the ${TARGET_2_DESC}.`, }, ], }, - foldRegion: { - name: "Fold region", - defaultSpokenForm: "fold", + + // Group: swap + swapTargets: { + name: "Swap targets", + defaultSpokenForm: "swap", + group: { id: "swap", index: 0 }, syntaxes: [ { - pattern: DEFAULT_PATTERN, - description: `Fold region at ${VAR_TARGET}.`, - cheatsheet: "Fold region", + pattern: `${VAR_SPOKEN_FORM} ${WITH} ${VAR_TARGET}`, + description: `Swap selection with ${VAR_TARGET}.`, + cheatsheet: `Swap selection with ${VAR_TARGET}`, }, - ], - examples: [ { - command: `${VAR_SPOKEN_FORM} ${FUNCTION} ${TARGET}`, - description: `Folds the function containing the ${TARGET_DESC}.`, + pattern: `${VAR_SPOKEN_FORM} ${VAR_TARGET_1} ${WITH} ${VAR_TARGET_2}`, + description: `Swap ${VAR_TARGET_1} with ${VAR_TARGET_2}.`, + cheatsheet: `Swap ${VAR_TARGET_1} with ${VAR_TARGET_2}`, }, ], - }, - followLink: { - name: "Follow link", - defaultSpokenForm: "follow", - syntaxes: [ + examples: [ { - pattern: DEFAULT_PATTERN, - description: `Follow link at ${VAR_TARGET}.`, - cheatsheet: "Follow link", + command: `${VAR_SPOKEN_FORM} ${WITH} ${TARGET}`, + description: `Swaps the current selection with the ${TARGET_DESC}.`, }, - ], - examples: [ { - command: DEFAULT_COMMAND, - description: `Opens the link containing the ${TARGET_DESC}.`, + command: `${VAR_SPOKEN_FORM} ${TARGET} ${WITH} ${TARGET_2}`, + description: `Swaps the ${TARGET_DESC} and the ${TARGET_2_DESC}.`, }, ], }, - followLinkAside: { - name: "Follow link aside", - defaultSpokenForm: "follow split", + + // Group: move + moveToTarget: { + name: "Move to target", + defaultSpokenForm: "move", + group: { id: "move", index: 0 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Follow link at ${VAR_TARGET} aside (e.g. in a split view).`, - cheatsheet: "Follow link aside", - }, - ], - examples: [ - { - command: DEFAULT_COMMAND, - description: `Opens the link containing the ${TARGET_DESC} in a split view.`, + description: `Move ${VAR_TARGET} to selection.`, + cheatsheet: `Move ${VAR_TARGET} to selection`, }, - ], - }, - gitAccept: { - name: "Git accept", - defaultSpokenForm: "git accept", - syntaxes: [ { - pattern: DEFAULT_PATTERN, - description: `Accept Git change at ${VAR_TARGET}.`, - cheatsheet: "Git accept", + pattern: `${VAR_SPOKEN_FORM} ${VAR_TARGET} ${VAR_DESTINATION}`, + description: `Move ${VAR_TARGET} to ${VAR_DESTINATION}.`, + cheatsheet: `Move ${VAR_TARGET} to ${VAR_DESTINATION}`, }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Accepts the Git change on the line containing the ${TARGET_DESC}.`, - }, - ], - }, - gitRevert: { - name: "Git revert", - defaultSpokenForm: "git revert", - syntaxes: [ - { - pattern: DEFAULT_PATTERN, - description: `Revert Git change at ${VAR_TARGET}.`, - cheatsheet: "Git revert", + description: `Moves the ${TARGET_DESC} to the current selection.`, }, - ], - examples: [ { - command: DEFAULT_COMMAND, - description: `Reverts the Git change on the line containing the ${TARGET_DESC}.`, + command: `${VAR_SPOKEN_FORM} ${TARGET} ${AFTER} ${TARGET_2}`, + description: `Moves the ${TARGET_DESC} to after the ${TARGET_2_DESC}.`, }, ], }, - gitStage: { - name: "Git stage", - defaultSpokenForm: "git stage", + + // Group: indentation + indentLine: { + name: "Indent line", + defaultSpokenForm: "indent", + group: { id: "indentation", index: 0 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Stage Git change at ${VAR_TARGET}.`, - cheatsheet: "Git stage", + description: `Indent line containing ${VAR_TARGET}.`, + cheatsheet: "Indent line", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Stages the Git change on the line containing the ${TARGET_DESC}.`, + description: `Indents the line containing the ${TARGET_DESC}.`, }, ], }, - gitUnstage: { - name: "Git unstage", - defaultSpokenForm: "git unstage", + outdentLine: { + name: "Outdent line", + defaultSpokenForm: "dedent", + group: { id: "indentation", index: 1 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Unstage Git change at ${VAR_TARGET}.`, - cheatsheet: "Git unstage", + description: `Outdent line containing ${VAR_TARGET}.`, + cheatsheet: "Outdent line", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Unstages the Git change on the line containing the ${TARGET_DESC}.`, + description: `Decreases the indentation of the line containing the ${TARGET_DESC}.`, }, ], }, - increment: { - name: "Increment", - defaultSpokenForm: "increment", + + // Group: emptyLines + editNewLineBefore: { + name: "Edit new line/scope before", + defaultSpokenForm: "drink", + group: { id: "emptyLines", index: 0 }, + description: "Scope defaults to line.", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Increment number at ${VAR_TARGET}.`, - cheatsheet: "Increment number", - }, - ], - examples: [ - { - command: `${VAR_SPOKEN_FORM} ${TARGET_NUMBER}`, - description: `Increments the ${TARGET_NUMBER_DESC}.`, + description: `Edit new line before ${VAR_TARGET}.`, + cheatsheet: "Edit new line before", }, - ], - }, - indentLine: { - name: "Indent line", - defaultSpokenForm: "indent", - syntaxes: [ { - pattern: DEFAULT_PATTERN, - description: `Indent line containing ${VAR_TARGET}.`, - cheatsheet: "Indent line", + pattern: `${VAR_SPOKEN_FORM} ${VAR_SCOPE} ${VAR_TARGET}`, + description: `Edit new ${VAR_SCOPE} before ${VAR_TARGET}.`, + cheatsheet: `Edit new ${VAR_SCOPE} before`, }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Indents the line containing the ${TARGET_DESC}.`, - }, - ], - }, - insertCopyAfter: { - name: "Insert copy after", - defaultSpokenForm: "clone", - syntaxes: [ - { - pattern: DEFAULT_PATTERN, - description: `Insert copy after ${VAR_TARGET}.`, - cheatsheet: "Insert copy after", + description: `Inserts a new line above the ${TARGET_DESC} and moves the cursor to it.`, }, - ], - examples: [ { - command: `${VAR_SPOKEN_FORM} ${FUNCTION} ${TARGET}`, - description: `Inserts a copy of the function containing the ${TARGET_DESC} after itself.`, + command: `${VAR_SPOKEN_FORM} ${ITEM} ${TARGET}`, + description: `Inserts the delimiters for a new collection item before the item containing the ${TARGET_DESC} and moves the cursor there.`, }, ], }, - insertCopyBefore: { - name: "Insert copy before", - defaultSpokenForm: "clone up", + editNewLineAfter: { + name: "Edit new line/scope after", + defaultSpokenForm: "pour", + group: { id: "emptyLines", index: 1 }, + description: "Scope defaults to line.", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Insert copy before ${VAR_TARGET}.`, - cheatsheet: "Insert copy before", - }, - ], - examples: [ - { - command: `${VAR_SPOKEN_FORM} ${FUNCTION} ${TARGET}`, - description: `Inserts a copy of the function containing the ${TARGET_DESC} before itself.`, + description: `Edit new line after ${VAR_TARGET}.`, + cheatsheet: "Edit new line after", }, - ], - }, - insertEmptyLineAfter: { - name: "Insert empty line/scope after", - defaultSpokenForm: "float", - syntaxes: [ { - pattern: DEFAULT_PATTERN, - description: `Insert empty line/scope after ${VAR_TARGET}.`, - cheatsheet: "Insert empty line/scope after", + pattern: `${VAR_SPOKEN_FORM} ${VAR_SCOPE} ${VAR_TARGET}`, + description: `Edit new ${VAR_SCOPE} after ${VAR_TARGET}.`, + cheatsheet: `Edit new ${VAR_SCOPE} after`, }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Inserts an empty line below the ${TARGET_DESC} without moving the cursor.`, + description: `Inserts a new line below the ${TARGET_DESC} and moves the cursor to it.`, }, { command: `${VAR_SPOKEN_FORM} ${ITEM} ${TARGET}`, - description: `Inserts the required delimiter after the collection item containing the ${TARGET_DESC}.`, + description: `Inserts the delimiters for a new collection item after the item containing the ${TARGET_DESC} and moves the cursor there.`, }, ], }, insertEmptyLineBefore: { name: "Insert empty line/scope before", defaultSpokenForm: "drop", + group: { id: "emptyLines", index: 2 }, syntaxes: [ { pattern: DEFAULT_PATTERN, @@ -570,64 +539,74 @@ export const actionReferences = { }, ], }, - insertEmptyLinesAround: { - name: "Insert empty lines/scopes around", - defaultSpokenForm: "puff", + insertEmptyLineAfter: { + name: "Insert empty line/scope after", + defaultSpokenForm: "float", + group: { id: "emptyLines", index: 3 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Insert empty lines/scopes around ${VAR_TARGET}.`, - cheatsheet: "Insert empty lines/scopes around", + description: `Insert empty line/scope after ${VAR_TARGET}.`, + cheatsheet: "Insert empty line/scope after", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Inserts empty lines around the line containing the ${TARGET_DESC} without moving the cursor.`, + description: `Inserts an empty line below the ${TARGET_DESC} without moving the cursor.`, }, { - command: `${VAR_SPOKEN_FORM} ${TOKEN} ${TARGET}`, - description: `Inserts spaces around the ${TARGET_DESC}.`, + command: `${VAR_SPOKEN_FORM} ${ITEM} ${TARGET}`, + description: `Inserts the required delimiter after the collection item containing the ${TARGET_DESC}.`, }, ], }, - joinLines: { - name: "Join lines", - defaultSpokenForm: "join", + insertEmptyLinesAround: { + name: "Insert empty lines/scopes around", + defaultSpokenForm: "puff", + group: { id: "emptyLines", index: 4 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Join lines at ${VAR_TARGET}.`, - cheatsheet: "Join lines", + description: `Insert empty lines/scopes around ${VAR_TARGET}.`, + cheatsheet: "Insert empty lines/scopes around", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Joins the line containing the ${TARGET_DESC} with the following line.`, + description: `Inserts empty lines around the line containing the ${TARGET_DESC} without moving the cursor.`, + }, + { + command: `${VAR_SPOKEN_FORM} ${TOKEN} ${TARGET}`, + description: `Inserts spaces around the ${TARGET_DESC}.`, }, ], }, - outdentLine: { - name: "Outdent line", - defaultSpokenForm: "dedent", + + // Group: reorder + reverseTargets: { + name: "Reverse targets", + defaultSpokenForm: "reverse", + group: { id: "reorder", index: 0 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Outdent line containing ${VAR_TARGET}.`, - cheatsheet: "Outdent line", + description: `Reverse ${VAR_TARGET}s.`, + cheatsheet: "Reverse targets", }, ], examples: [ { - command: DEFAULT_COMMAND, - description: `Decreases the indentation of the line containing the ${TARGET_DESC}.`, + command: `${VAR_SPOKEN_FORM} ${EVERY} ${ITEM} ${TARGET}`, + description: `Reverses the collection items associated with the ${TARGET_DESC}.`, }, ], }, randomizeTargets: { name: "Randomize targets", defaultSpokenForm: "shuffle", + group: { id: "reorder", index: 1 }, syntaxes: [ { pattern: DEFAULT_PATTERN, @@ -642,327 +621,322 @@ export const actionReferences = { }, ], }, - remove: { - name: "Remove", - defaultSpokenForm: REMOVE, - description: - "This action can be used to remove a target without moving the cursor.", + sortTargets: { + name: "Sort targets", + defaultSpokenForm: "sort", + group: { id: "reorder", index: 2 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Remove ${VAR_TARGET}.`, - cheatsheet: "Remove", + description: `Sort ${VAR_TARGET}s.`, + cheatsheet: "Sort targets", }, ], examples: [ { - command: DEFAULT_COMMAND, - description: `Removes the ${TARGET_DESC}.`, + command: `${VAR_SPOKEN_FORM} ${EVERY} ${ITEM} ${TARGET}`, + description: `Sorts the collection items associated with the ${TARGET_DESC}.`, }, ], }, - rename: { - name: "Rename", - defaultSpokenForm: "rename", + + // Group: wrap + wrapWithPairedDelimiter: { + name: "Wrap with paired delimiter/snippet", + defaultSpokenForm: "wrap", + group: { id: "wrap", index: 0 }, syntaxes: [ { - pattern: DEFAULT_PATTERN, - description: `Rename ${VAR_TARGET}.`, - cheatsheet: "Rename", - }, - ], - examples: [ - { - command: DEFAULT_COMMAND, - description: `Starts renaming the ${TARGET_DESC}.`, + pattern: `${VAR_PAIR} ${VAR_SPOKEN_FORM} ${VAR_TARGET}`, + description: `Wrap ${VAR_TARGET} with ${VAR_PAIR}.`, + cheatsheet: `Wrap ${VAR_TARGET} with ${VAR_PAIR}`, }, - ], - }, - revealDefinition: { - name: "Reveal definition", - defaultSpokenForm: "define", - syntaxes: [ { - pattern: DEFAULT_PATTERN, - description: `Reveal definition of ${VAR_TARGET}.`, - cheatsheet: "Reveal definition", + pattern: `${VAR_SNIPPET} ${VAR_SPOKEN_FORM} ${VAR_TARGET}`, + description: `Wrap ${VAR_TARGET} with ${VAR_SNIPPET}.`, + cheatsheet: `Wrap ${VAR_TARGET} with ${VAR_SNIPPET}`, }, ], examples: [ { - command: DEFAULT_COMMAND, - description: `Opens the definition of the ${TARGET_DESC}.`, - }, - ], - }, - revealTypeDefinition: { - name: "Reveal type definition", - defaultSpokenForm: "type deaf", - syntaxes: [ - { - pattern: DEFAULT_PATTERN, - description: `Reveal type definition of ${VAR_TARGET}.`, - cheatsheet: "Reveal type definition", + command: `${SQUARE} ${VAR_SPOKEN_FORM} ${TARGET}`, + description: `Wraps the ${TARGET_DESC} in square brackets.`, }, - ], - examples: [ { - command: DEFAULT_COMMAND, - description: `Opens the type definition of the ${TARGET_DESC}.`, + command: `${SNIPPET_IF} ${VAR_SPOKEN_FORM} ${TARGET}`, + description: `Wraps the ${TARGET_DESC} in an if-statement snippet.`, }, ], }, - reverseTargets: { - name: "Reverse targets", - defaultSpokenForm: "reverse", + rewrapWithPairedDelimiter: { + name: "Rewrap with paired delimiter", + defaultSpokenForm: "repack", + group: { id: "wrap", index: 1 }, syntaxes: [ { - pattern: DEFAULT_PATTERN, - description: `Reverse ${VAR_TARGET}s.`, - cheatsheet: "Reverse targets", + pattern: `${VAR_PAIR} ${VAR_SPOKEN_FORM} ${VAR_TARGET}`, + description: `Rewrap ${VAR_TARGET} with ${VAR_PAIR}.`, + cheatsheet: `Rewrap ${VAR_TARGET} with ${VAR_PAIR}`, }, ], examples: [ { - command: `${VAR_SPOKEN_FORM} ${EVERY} ${ITEM} ${TARGET}`, - description: `Reverses the collection items associated with the ${TARGET_DESC}.`, + command: `${CURLY} ${VAR_SPOKEN_FORM} ${TARGET}`, + description: `Replaces the paired delimiters around the ${TARGET_DESC} with curly brackets.`, }, ], }, - scrollToBottom: { - name: "Scroll to bottom", - defaultSpokenForm: "bottom", + + // Group: numbers + increment: { + name: "Increment", + defaultSpokenForm: "increment", + group: { id: "numbers", index: 0 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Scroll ${VAR_TARGET} to bottom of the viewport.`, - cheatsheet: "Scroll to bottom", + description: `Increment number at ${VAR_TARGET}.`, + cheatsheet: "Increment number", }, ], examples: [ { - command: DEFAULT_COMMAND, - description: `Scrolls the ${TARGET_DESC} to the bottom of the viewport.`, + command: `${VAR_SPOKEN_FORM} ${TARGET_NUMBER}`, + description: `Increments the ${TARGET_NUMBER_DESC}.`, }, ], }, - scrollToCenter: { - name: "Scroll to center", - defaultSpokenForm: "center", + decrement: { + name: "Decrement", + defaultSpokenForm: "decrement", + group: { id: "numbers", index: 1 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Scroll ${VAR_TARGET} to center of the viewport.`, - cheatsheet: "Scroll to center", + description: `Decrement number at ${VAR_TARGET}.`, + cheatsheet: "Decrement number", }, ], examples: [ { - command: DEFAULT_COMMAND, - description: `Scrolls the ${TARGET_DESC} to the center of the viewport.`, + command: `${VAR_SPOKEN_FORM} ${TARGET_NUMBER}`, + description: `Decrements the number at the ${TARGET_NUMBER_DESC}.`, }, ], }, - scrollToTop: { - name: "Scroll to top", - defaultSpokenForm: "crown", + + // Group: refactor + rename: { + name: "Rename", + defaultSpokenForm: "rename", + group: { id: "refactor", index: 0 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Scroll ${VAR_TARGET} to top of the viewport.`, - cheatsheet: "Scroll to top", + description: `Rename ${VAR_TARGET}.`, + cheatsheet: "Rename", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Scrolls the ${TARGET_DESC} to the top of the viewport.`, + description: `Starts renaming the ${TARGET_DESC}.`, }, ], }, - setSelection: { - name: "Set selection", - defaultSpokenForm: SET_SELECTION, + extractVariable: { + name: "Extract variable", + defaultSpokenForm: "extract", + group: { id: "refactor", index: 1 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Set selection to ${VAR_TARGET}.`, - cheatsheet: "Set selection", + description: `Extract variable from ${VAR_TARGET}.`, + cheatsheet: "Extract variable", }, ], examples: [ { - command: DEFAULT_COMMAND, - description: `Selects the ${TARGET_DESC}.`, + command: `${VAR_SPOKEN_FORM} ${VALUE} ${TARGET}`, + description: `Extracts the value containing the ${TARGET_DESC} into a variable.`, }, ], }, - setSelectionAfter: { - name: "Set selection after", - defaultSpokenForm: "post", + showQuickFix: { + name: "Show quick fix", + defaultSpokenForm: "quick fix", + group: { id: "refactor", index: 2 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Set empty selection after ${VAR_TARGET}.`, - cheatsheet: "Set selection after", + description: `Show quick fix for ${VAR_TARGET}.`, + cheatsheet: "Show quick fix", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Places the cursor after the ${TARGET_DESC}.`, + description: `Shows quick fixes for the ${TARGET_DESC}.`, }, ], }, - setSelectionBefore: { - name: "Set selection before", - defaultSpokenForm: "pre", + + // Group: joinBreak + joinLines: { + name: "Join lines", + defaultSpokenForm: "join", + group: { id: "joinBreak", index: 0 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Set empty selection before ${VAR_TARGET}.`, - cheatsheet: "Set selection before", + description: `Join lines at ${VAR_TARGET}.`, + cheatsheet: "Join lines", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Places the cursor before the ${TARGET_DESC}.`, + description: `Joins the line containing the ${TARGET_DESC} with the following line.`, }, ], }, - showDebugHover: { - name: "Show debug hover", - defaultSpokenForm: "inspect", + breakLine: { + name: "Break line", + defaultSpokenForm: "break", + group: { id: "joinBreak", index: 1 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Show debug hover for ${VAR_TARGET}.`, - cheatsheet: "Show debug hover", + description: `Breaks the line before ${VAR_TARGET}.`, + cheatsheet: "Breaks the line", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Shows debug information for the ${TARGET_DESC}.`, + description: `Breaks the line before the ${TARGET_DESC}.`, }, ], }, - showHover: { - name: "Show hover", - defaultSpokenForm: "hover", + + // Group: snippets + generateSnippet: { + name: "Generate snippet", + defaultSpokenForm: "snip make", + group: { id: "snippets", index: 0 }, + legacySpokenForms: ["snippet make"], syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Show hover for ${VAR_TARGET}.`, - cheatsheet: "Show hover", + description: `Generate snippet from ${VAR_TARGET}.`, + cheatsheet: "Generate snippet", }, ], examples: [ { - command: DEFAULT_COMMAND, - description: `Shows hover information for the ${TARGET_DESC}.`, + command: `${VAR_SPOKEN_FORM} ${FUNCTION} ${TARGET}`, + description: `Generates a snippet from the function containing the ${TARGET_DESC}.`, }, ], }, - showQuickFix: { - name: "Show quick fix", - defaultSpokenForm: "quick fix", + insertSnippet: { + name: "Insert snippet", + defaultSpokenForm: "snip", + group: { id: "snippets", index: 1 }, syntaxes: [ { - pattern: DEFAULT_PATTERN, - description: `Show quick fix for ${VAR_TARGET}.`, - cheatsheet: "Show quick fix", + pattern: `${VAR_SPOKEN_FORM} ${VAR_SNIPPET} ${VAR_DESTINATION}`, + description: `Insert snippet at ${VAR_DESTINATION}.`, + cheatsheet: `Insert snippet at ${VAR_DESTINATION}`, }, ], examples: [ { - command: DEFAULT_COMMAND, - description: `Shows quick fixes for the ${TARGET_DESC}.`, + command: `${VAR_SPOKEN_FORM} ${SNIPPET_IF} ${AFTER} ${TARGET}`, + description: `Inserts an if-statement snippet after the ${TARGET_DESC}.`, }, ], }, - showReferences: { - name: "Show references", - defaultSpokenForm: "reference", + + // Group: scroll + scrollToTop: { + name: "Scroll to top", + defaultSpokenForm: "crown", + group: { id: "scroll", index: 0 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Show references for ${VAR_TARGET}.`, - cheatsheet: "Show references", + description: `Scroll ${VAR_TARGET} to top of the viewport.`, + cheatsheet: "Scroll to top", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Shows references to the ${TARGET_DESC}.`, + description: `Scrolls the ${TARGET_DESC} to the top of the viewport.`, }, ], }, - sortTargets: { - name: "Sort targets", - defaultSpokenForm: "sort", + scrollToCenter: { + name: "Scroll to center", + defaultSpokenForm: "center", + group: { id: "scroll", index: 1 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Sort ${VAR_TARGET}s.`, - cheatsheet: "Sort targets", + description: `Scroll ${VAR_TARGET} to center of the viewport.`, + cheatsheet: "Scroll to center", }, ], examples: [ { - command: `${VAR_SPOKEN_FORM} ${EVERY} ${ITEM} ${TARGET}`, - description: `Sorts the collection items associated with the ${TARGET_DESC}.`, + command: DEFAULT_COMMAND, + description: `Scrolls the ${TARGET_DESC} to the center of the viewport.`, }, ], }, - toggleLineBreakpoint: { - name: "Toggle line/scope breakpoint", - defaultSpokenForm: "break point", - description: "Scope defaults to line.", + scrollToBottom: { + name: "Scroll to bottom", + defaultSpokenForm: "bottom", + group: { id: "scroll", index: 2 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Toggle breakpoint on line containing ${VAR_TARGET}.`, - cheatsheet: "Toggle line breakpoint", - }, - { - pattern: `${VAR_SPOKEN_FORM} ${TOKEN} ${VAR_TARGET}`, - description: `Toggle inline breakpoint at ${VAR_TARGET}.`, - cheatsheet: "Toggle inline breakpoint", + description: `Scroll ${VAR_TARGET} to bottom of the viewport.`, + cheatsheet: "Scroll to bottom", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Toggles a breakpoint on the line containing the ${TARGET_DESC}.`, - }, - { - command: `${VAR_SPOKEN_FORM} ${TOKEN} ${TARGET}`, - description: `Toggles an inline breakpoint at the ${TARGET_DESC}.`, + description: `Scrolls the ${TARGET_DESC} to the bottom of the viewport.`, }, ], }, - toggleLineComment: { - name: "Toggle line comment", - defaultSpokenForm: "comment", + + // Group: folding + foldRegion: { + name: "Fold region", + defaultSpokenForm: "fold", + group: { id: "folding", index: 0 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Toggle line comment at ${VAR_TARGET}.`, - cheatsheet: "Toggle line comment", + description: `Fold region at ${VAR_TARGET}.`, + cheatsheet: "Fold region", }, ], examples: [ { - command: DEFAULT_COMMAND, - description: `Toggles the comment on the line containing the ${TARGET_DESC}.`, + command: `${VAR_SPOKEN_FORM} ${FUNCTION} ${TARGET}`, + description: `Folds the function containing the ${TARGET_DESC}.`, }, ], }, unfoldRegion: { name: "Unfold region", defaultSpokenForm: "unfold", + group: { id: "folding", index: 1 }, syntaxes: [ { pattern: DEFAULT_PATTERN, @@ -977,262 +951,400 @@ export const actionReferences = { }, ], }, - callAsFunction: { - name: "Call as function", - defaultSpokenForm: "call", + + // Group: homophones + nextHomophone: { + name: "Next homophone", + defaultSpokenForm: "phones", + group: { id: "homophones", index: 0 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Insert call to ${VAR_TARGET} on selection.`, - cheatsheet: `Insert call to ${VAR_TARGET} on selection`, - }, - { - pattern: `${VAR_SPOKEN_FORM} ${VAR_TARGET_1} ${ON} ${VAR_TARGET_2}`, - description: `Insert call to ${VAR_TARGET_1} on ${VAR_TARGET_2}.`, - cheatsheet: `Insert call to ${VAR_TARGET_1} on ${VAR_TARGET_2}`, + description: `Cycle to next homophone for ${VAR_TARGET}.`, + cheatsheet: "Cycle to next homophone", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Inserts a call to the ${TARGET_DESC} at the current selection.`, + description: `Replaces the ${TARGET_DESC} with its next homophone.`, }, + ], + }, + + // Group: format + applyFormatter: { + name: "Apply formatter", + defaultSpokenForm: "format", + group: { id: "format", index: 0 }, + syntaxes: [ { - command: `${VAR_SPOKEN_FORM} ${TARGET} ${ON} ${TARGET_2}`, - description: `Inserts a call to the ${TARGET_DESC} on the ${TARGET_2_DESC}.`, + pattern: `${VAR_SPOKEN_FORM} ${VAR_FORMATTER} ${AT} ${VAR_TARGET}`, + description: `Reformat ${VAR_TARGET} as ${VAR_FORMATTER}.`, + cheatsheet: `Reformat ${VAR_TARGET} as ${VAR_FORMATTER}`, + }, + ], + examples: [ + { + command: `${VAR_SPOKEN_FORM} ${FORMATTER_CAMEL} ${AT} ${TARGET}`, + description: `Reformats the ${TARGET_DESC} as camel case.`, }, ], }, - generateSnippet: { - name: "Generate snippet", - defaultSpokenForm: "snip make", - legacySpokenForms: ["snippet make"], + + // Group: instanceReference + "experimental.setInstanceReference": { + name: "Set instance reference", + defaultSpokenForm: "from", + group: { id: "instanceReference", index: 0 }, + description: + "Sets the instance reference for the next 'instance of' action.", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Generate snippet from ${VAR_TARGET}.`, - cheatsheet: "Generate snippet", + description: `Set instance reference to ${VAR_TARGET}.`, + cheatsheet: "Set instance reference", }, ], examples: [ { - command: `${VAR_SPOKEN_FORM} ${FUNCTION} ${TARGET}`, - description: `Generates a snippet from the function containing the ${TARGET_DESC}.`, + command: `${VAR_SPOKEN_FORM} ${FUNCTION} ${TARGET} ${SET_SELECTION} ${EVERY} ${INSTANCE} ${TARGET_2}`, + description: `Selects every instance of the ${TARGET_2_DESC} within the function containing the ${TARGET_DESC}.`, }, ], }, - highlight: { - name: "Highlight", - defaultSpokenForm: "highlight", + + // Group: comment + toggleLineComment: { + name: "Toggle line comment", + defaultSpokenForm: "comment", + group: { id: "comment", index: 0 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Highlight ${VAR_TARGET}.`, - cheatsheet: "Highlight", + description: `Toggle line comment at ${VAR_TARGET}.`, + cheatsheet: "Toggle line comment", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Highlights the ${TARGET_DESC}.`, + description: `Toggles the comment on the line containing the ${TARGET_DESC}.`, }, ], }, - insertSnippet: { - name: "Insert snippet", - defaultSpokenForm: "snip", + + // Group: breakpoint + toggleLineBreakpoint: { + name: "Toggle line/scope breakpoint", + defaultSpokenForm: "break point", + group: { id: "breakpoint", index: 0 }, + description: "Scope defaults to line.", syntaxes: [ { - pattern: `${VAR_SPOKEN_FORM} ${VAR_SNIPPET} ${VAR_DESTINATION}`, - description: `Insert snippet at ${VAR_DESTINATION}.`, - cheatsheet: `Insert snippet at ${VAR_DESTINATION}`, + pattern: DEFAULT_PATTERN, + description: `Toggle breakpoint on line containing ${VAR_TARGET}.`, + cheatsheet: "Toggle line breakpoint", + }, + { + pattern: `${VAR_SPOKEN_FORM} ${TOKEN} ${VAR_TARGET}`, + description: `Toggle inline breakpoint at ${VAR_TARGET}.`, + cheatsheet: "Toggle inline breakpoint", }, ], examples: [ { - command: `${VAR_SPOKEN_FORM} ${SNIPPET_IF} ${AFTER} ${TARGET}`, - description: `Inserts an if-statement snippet after the ${TARGET_DESC}.`, + command: DEFAULT_COMMAND, + description: `Toggles a breakpoint on the line containing the ${TARGET_DESC}.`, + }, + { + command: `${VAR_SPOKEN_FORM} ${TOKEN} ${TARGET}`, + description: `Toggles an inline breakpoint at the ${TARGET_DESC}.`, }, ], }, - moveToTarget: { - name: "Move to target", - defaultSpokenForm: "move", + + // Group: navigation + revealDefinition: { + name: "Reveal definition", + defaultSpokenForm: "define", + group: { id: "navigation", index: 0 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Move ${VAR_TARGET} to selection.`, - cheatsheet: `Move ${VAR_TARGET} to selection`, + description: `Reveal definition of ${VAR_TARGET}.`, + cheatsheet: "Reveal definition", }, + ], + examples: [ { - pattern: `${VAR_SPOKEN_FORM} ${VAR_TARGET} ${VAR_DESTINATION}`, - description: `Move ${VAR_TARGET} to ${VAR_DESTINATION}.`, - cheatsheet: `Move ${VAR_TARGET} to ${VAR_DESTINATION}`, + command: DEFAULT_COMMAND, + description: `Opens the definition of the ${TARGET_DESC}.`, + }, + ], + }, + revealTypeDefinition: { + name: "Reveal type definition", + defaultSpokenForm: "type deaf", + group: { id: "navigation", index: 1 }, + syntaxes: [ + { + pattern: DEFAULT_PATTERN, + description: `Reveal type definition of ${VAR_TARGET}.`, + cheatsheet: "Reveal type definition", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Moves the ${TARGET_DESC} to the current selection.`, + description: `Opens the type definition of the ${TARGET_DESC}.`, }, + ], + }, + showReferences: { + name: "Show references", + defaultSpokenForm: "reference", + group: { id: "navigation", index: 2 }, + syntaxes: [ { - command: `${VAR_SPOKEN_FORM} ${TARGET} ${AFTER} ${TARGET_2}`, - description: `Moves the ${TARGET_DESC} to after the ${TARGET_2_DESC}.`, + pattern: DEFAULT_PATTERN, + description: `Show references for ${VAR_TARGET}.`, + cheatsheet: "Show references", + }, + ], + examples: [ + { + command: DEFAULT_COMMAND, + description: `Shows references to the ${TARGET_DESC}.`, }, ], }, - pasteFromClipboard: { - name: "Paste from clipboard", - defaultSpokenForm: "paste", + showHover: { + name: "Show hover", + defaultSpokenForm: "hover", + group: { id: "navigation", index: 3 }, syntaxes: [ { - pattern: `${VAR_SPOKEN_FORM} ${VAR_DESTINATION}`, - description: `Paste from clipboard at ${VAR_DESTINATION}.`, - cheatsheet: `Paste from clipboard at ${VAR_DESTINATION}`, + pattern: DEFAULT_PATTERN, + description: `Show hover for ${VAR_TARGET}.`, + cheatsheet: "Show hover", }, ], examples: [ { - command: `${VAR_SPOKEN_FORM} ${AFTER} ${TARGET}`, - description: `Pastes the clipboard contents after the ${TARGET_DESC}.`, + command: DEFAULT_COMMAND, + description: `Shows hover information for the ${TARGET_DESC}.`, }, ], }, - replaceWithTarget: { - name: "Replace with target", - defaultSpokenForm: "bring", + findInDocument: { + name: "Find in document", + defaultSpokenForm: "scout", + group: { id: "navigation", index: 4 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Insert copy of ${VAR_TARGET} at selection.`, - cheatsheet: `Insert copy of ${VAR_TARGET} at selection`, + description: `Find ${VAR_TARGET} in document.`, + cheatsheet: "Find in document", }, + ], + examples: [ { - pattern: `${VAR_SPOKEN_FORM} ${VAR_TARGET} ${VAR_DESTINATION}`, - description: `Copy ${VAR_TARGET} to ${VAR_DESTINATION}.`, - cheatsheet: `Copy ${VAR_TARGET} to ${VAR_DESTINATION}`, + command: DEFAULT_COMMAND, + description: `Searches the current document for the ${TARGET_DESC}.`, + }, + ], + }, + findInWorkspace: { + name: "Find in workspace", + defaultSpokenForm: "scout all", + group: { id: "navigation", index: 5 }, + syntaxes: [ + { + pattern: DEFAULT_PATTERN, + description: `Find ${VAR_TARGET} in workspace.`, + cheatsheet: "Find in workspace", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Inserts a copy of the ${TARGET_DESC} at the current selection.`, + description: `Searches the workspace for the ${TARGET_DESC}.`, + }, + ], + }, + followLink: { + name: "Follow link", + defaultSpokenForm: "follow", + group: { id: "navigation", index: 6 }, + syntaxes: [ + { + pattern: DEFAULT_PATTERN, + description: `Follow link at ${VAR_TARGET}.`, + cheatsheet: "Follow link", }, + ], + examples: [ { - command: `${VAR_SPOKEN_FORM} ${TARGET} ${TO} ${TARGET_2}`, - description: `Replaces the ${TARGET_2_DESC} with a copy of the ${TARGET_DESC}.`, + command: DEFAULT_COMMAND, + description: `Opens the link containing the ${TARGET_DESC}.`, }, ], }, - rewrapWithPairedDelimiter: { - name: "Rewrap with paired delimiter", - defaultSpokenForm: "repack", + followLinkAside: { + name: "Follow link aside", + defaultSpokenForm: "follow split", + group: { id: "navigation", index: 7 }, syntaxes: [ { - pattern: `${VAR_PAIR} ${VAR_SPOKEN_FORM} ${VAR_TARGET}`, - description: `Rewrap ${VAR_TARGET} with ${VAR_PAIR}.`, - cheatsheet: `Rewrap ${VAR_TARGET} with ${VAR_PAIR}`, + pattern: DEFAULT_PATTERN, + description: `Follow link at ${VAR_TARGET} aside (e.g. in a split view).`, + cheatsheet: "Follow link aside", }, ], examples: [ { - command: `${CURLY} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Replaces the paired delimiters around the ${TARGET_DESC} with curly brackets.`, + command: DEFAULT_COMMAND, + description: `Opens the link containing the ${TARGET_DESC} in a split view.`, }, ], }, - swapTargets: { - name: "Swap targets", - defaultSpokenForm: "swap", + showDebugHover: { + name: "Show debug hover", + defaultSpokenForm: "inspect", + group: { id: "navigation", index: 8 }, syntaxes: [ { - pattern: `${VAR_SPOKEN_FORM} ${WITH} ${VAR_TARGET}`, - description: `Swap selection with ${VAR_TARGET}.`, - cheatsheet: `Swap selection with ${VAR_TARGET}`, + pattern: DEFAULT_PATTERN, + description: `Show debug hover for ${VAR_TARGET}.`, + cheatsheet: "Show debug hover", }, + ], + examples: [ { - pattern: `${VAR_SPOKEN_FORM} ${VAR_TARGET_1} ${WITH} ${VAR_TARGET_2}`, - description: `Swap ${VAR_TARGET_1} with ${VAR_TARGET_2}.`, - cheatsheet: `Swap ${VAR_TARGET_1} with ${VAR_TARGET_2}`, + command: DEFAULT_COMMAND, + description: `Shows debug information for the ${TARGET_DESC}.`, }, ], - examples: [ + }, + + // Group: git + gitAccept: { + name: "Git accept", + defaultSpokenForm: "git accept", + group: { id: "git", index: 0 }, + syntaxes: [ { - command: `${VAR_SPOKEN_FORM} ${WITH} ${TARGET}`, - description: `Swaps the current selection with the ${TARGET_DESC}.`, + pattern: DEFAULT_PATTERN, + description: `Accept Git change at ${VAR_TARGET}.`, + cheatsheet: "Git accept", }, + ], + examples: [ { - command: `${VAR_SPOKEN_FORM} ${TARGET} ${WITH} ${TARGET_2}`, - description: `Swaps the ${TARGET_DESC} and the ${TARGET_2_DESC}.`, + command: DEFAULT_COMMAND, + description: `Accepts the Git change on the line containing the ${TARGET_DESC}.`, }, ], }, - wrapWithPairedDelimiter: { - name: "Wrap with paired delimiter/snippet", - defaultSpokenForm: "wrap", + gitRevert: { + name: "Git revert", + defaultSpokenForm: "git revert", + group: { id: "git", index: 1 }, syntaxes: [ { - pattern: `${VAR_PAIR} ${VAR_SPOKEN_FORM} ${VAR_TARGET}`, - description: `Wrap ${VAR_TARGET} with ${VAR_PAIR}.`, - cheatsheet: `Wrap ${VAR_TARGET} with ${VAR_PAIR}`, + pattern: DEFAULT_PATTERN, + description: `Revert Git change at ${VAR_TARGET}.`, + cheatsheet: "Git revert", }, + ], + examples: [ { - pattern: `${VAR_SNIPPET} ${VAR_SPOKEN_FORM} ${VAR_TARGET}`, - description: `Wrap ${VAR_TARGET} with ${VAR_SNIPPET}.`, - cheatsheet: `Wrap ${VAR_TARGET} with ${VAR_SNIPPET}`, + command: DEFAULT_COMMAND, + description: `Reverts the Git change on the line containing the ${TARGET_DESC}.`, + }, + ], + }, + gitStage: { + name: "Git stage", + defaultSpokenForm: "git stage", + group: { id: "git", index: 2 }, + syntaxes: [ + { + pattern: DEFAULT_PATTERN, + description: `Stage Git change at ${VAR_TARGET}.`, + cheatsheet: "Git stage", }, ], examples: [ { - command: `${SQUARE} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Wraps the ${TARGET_DESC} in square brackets.`, + command: DEFAULT_COMMAND, + description: `Stages the Git change on the line containing the ${TARGET_DESC}.`, }, + ], + }, + gitUnstage: { + name: "Git unstage", + defaultSpokenForm: "git unstage", + group: { id: "git", index: 3 }, + syntaxes: [ { - command: `${SNIPPET_IF} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Wraps the ${TARGET_DESC} in an if-statement snippet.`, + pattern: DEFAULT_PATTERN, + description: `Unstage Git change at ${VAR_TARGET}.`, + cheatsheet: "Git unstage", + }, + ], + examples: [ + { + command: DEFAULT_COMMAND, + description: `Unstages the Git change on the line containing the ${TARGET_DESC}.`, }, ], }, - applyFormatter: { - name: "Apply formatter", - defaultSpokenForm: "format", + + // Group: visual + flashTargets: { + name: "Flash target", + defaultSpokenForm: "flash", + group: { id: "visual", index: 0 }, syntaxes: [ { - pattern: `${VAR_SPOKEN_FORM} ${VAR_FORMATTER} ${AT} ${VAR_TARGET}`, - description: `Reformat ${VAR_TARGET} as ${VAR_FORMATTER}.`, - cheatsheet: `Reformat ${VAR_TARGET} as ${VAR_FORMATTER}`, + pattern: DEFAULT_PATTERN, + description: `Flash ${VAR_TARGET}.`, + cheatsheet: "Flash target", }, ], examples: [ { - command: `${VAR_SPOKEN_FORM} ${FORMATTER_CAMEL} ${AT} ${TARGET}`, - description: `Reformats the ${TARGET_DESC} as camel case.`, + command: DEFAULT_COMMAND, + description: `Briefly flashes the ${TARGET_DESC}.`, }, ], }, - nextHomophone: { - name: "Next homophone", - defaultSpokenForm: "phones", + highlight: { + name: "Highlight", + defaultSpokenForm: "highlight", + group: { id: "visual", index: 1 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: `Cycle to next homophone for ${VAR_TARGET}.`, - cheatsheet: "Cycle to next homophone", + description: `Highlight ${VAR_TARGET}.`, + cheatsheet: "Highlight", }, ], examples: [ { command: DEFAULT_COMMAND, - description: `Replaces the ${TARGET_DESC} with its next homophone.`, + description: `Highlights the ${TARGET_DESC}.`, }, ], }, - // Private actions -------------------- - + // Group: private "private.showParseTree": { name: "Show parse tree", defaultSpokenForm: "parse tree", + group: { id: "private", index: 0 }, private: true, syntaxes: [ { @@ -1252,12 +1364,14 @@ export const actionReferences = { name: "Parsed", defaultSpokenForm: "parsed", private: true, + group: { id: "private", index: 1 }, syntaxes: [], examples: [], }, "private.getTargets": { name: "Get targets", defaultSpokenForm: "get targets", + group: { id: "private", index: 2 }, private: true, syntaxes: [], examples: [], @@ -1265,6 +1379,7 @@ export const actionReferences = { "private.setKeyboardTarget": { name: "Set keyboard target", defaultSpokenForm: "set keyboard target", + group: { id: "private", index: 3 }, private: true, syntaxes: [], examples: [], @@ -1272,6 +1387,7 @@ export const actionReferences = { executeCommand: { name: "Execute command", defaultSpokenForm: "execute command", + group: { id: "private", index: 4 }, private: true, syntaxes: [], examples: [], @@ -1279,6 +1395,7 @@ export const actionReferences = { editNew: { name: "Edit new", defaultSpokenForm: "edit new", + group: { id: "private", index: 5 }, private: true, syntaxes: [], examples: [], @@ -1286,6 +1403,7 @@ export const actionReferences = { getText: { name: "Get text", defaultSpokenForm: "get text", + group: { id: "private", index: 6 }, private: true, syntaxes: [], examples: [], @@ -1293,6 +1411,7 @@ export const actionReferences = { replace: { name: "Replace", defaultSpokenForm: "replace", + group: { id: "private", index: 7 }, private: true, syntaxes: [], examples: [], @@ -1300,8 +1419,12 @@ export const actionReferences = { wrapWithSnippet: { name: "Wrap with snippet", defaultSpokenForm: "wrap", + group: { id: "private", index: 8 }, private: true, syntaxes: [], examples: [], }, -} as const satisfies Record; +} as const satisfies Record< + ActionType | TalonSideActionType, + ReferenceEntry +>; diff --git a/packages/lib-common/src/references/index.ts b/packages/lib-common/src/references/index.ts index d97391e702b..514298b5ae2 100644 --- a/packages/lib-common/src/references/index.ts +++ b/packages/lib-common/src/references/index.ts @@ -1,9 +1,12 @@ +export * from "./actionReferenceGroups"; export * from "./actionReferences"; -export * from "./spokenForms/connectiveDefaultSpokenForms"; -export * from "./spokenForms/graphemeDefaultSpokenForms"; -export * from "./spokenForms/markDefaultSpokenForms"; -export * from "./spokenForms/numberDefaultSpokenForms"; +export * from "./modifierReferenceGroups"; export * from "./modifierReferences"; export * from "./pairedDelimiterReferences"; export * from "./ReferenceEntry"; +export * from "./scopeReferenceGroups"; export * from "./scopeReferences"; +export * from "./spokenForms/connectiveDefaultSpokenForms"; +export * from "./spokenForms/graphemeDefaultSpokenForms"; +export * from "./spokenForms/markDefaultSpokenForms"; +export * from "./spokenForms/numberDefaultSpokenForms"; diff --git a/packages/lib-common/src/references/modifierReferenceGroups.ts b/packages/lib-common/src/references/modifierReferenceGroups.ts new file mode 100644 index 00000000000..373d5eda89b --- /dev/null +++ b/packages/lib-common/src/references/modifierReferenceGroups.ts @@ -0,0 +1,48 @@ +import type { ReferenceGroup } from "./ReferenceEntry"; + +export type ModifierReferenceGroupId = + | "position" + | "delimiters" + | "containing" + | "ordinal" + | "relative" + | "range" + | "filters" + | "inference" + | "private"; + +export const modifierReferenceGroups: ReferenceGroup[] = + [ + { + id: "containing", + name: "Scope containment", + }, + { + id: "ordinal", + name: "Ordinal scope", + }, + { + id: "relative", + name: "Relative scope", + }, + { + id: "delimiters", + name: "Interiors / delimiters", + }, + { + id: "range", + name: "Range extension", + }, + { + id: "position", + name: "Positions", + }, + { + id: "filters", + name: "Filters", + }, + { + id: "inference", + name: "Inference", + }, + ]; diff --git a/packages/lib-common/src/references/modifierReferences.ts b/packages/lib-common/src/references/modifierReferences.ts index 707cb700326..df63d75d9a4 100644 --- a/packages/lib-common/src/references/modifierReferences.ts +++ b/packages/lib-common/src/references/modifierReferences.ts @@ -14,6 +14,7 @@ import { VAR_SCOPE, VAR_SPOKEN_FORM, } from "./constants"; +import type { ModifierReferenceGroupId } from "./modifierReferenceGroups"; import { pairedDelimiterReferences } from "./pairedDelimiterReferences"; import type { ReferenceEntry } from "./ReferenceEntry"; import { connectiveDefaultSpokenForms } from "./spokenForms/connectiveDefaultSpokenForms"; @@ -35,94 +36,10 @@ const LAST = connectiveDefaultSpokenForms.last; type AdditionalModifierReferenceType = "ancestor"; export const modifierReferences = { - startOf: { - name: "Start of", - defaultSpokenForm: "start of", - syntaxes: [ - { - pattern: DEFAULT_PATTERN, - description: "Empty position at start of target.", - cheatsheet: "Empty position at start of target", - }, - ], - examples: [ - { - command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Places the cursor at the start of the ${TARGET_DESC}.`, - }, - ], - }, - endOf: { - name: "End of", - defaultSpokenForm: "end of", - syntaxes: [ - { - pattern: DEFAULT_PATTERN, - description: "Empty position at end of target.", - cheatsheet: "Empty position at end of target", - }, - ], - examples: [ - { - command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Places the cursor at the end of the ${TARGET_DESC}.`, - }, - ], - }, - interiorOnly: { - name: "Interior only", - defaultSpokenForm: "inside", - syntaxes: [ - { - pattern: DEFAULT_PATTERN, - description: "Interior only.", - cheatsheet: "Interior only", - }, - ], - examples: [ - { - command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${PARENTHESES} ${TARGET}`, - description: `Selects the contents of the parentheses containing the ${TARGET_DESC}, excluding the parentheses.`, - }, - ], - }, - excludeInterior: { - name: "Exclude interior", - defaultSpokenForm: "bounds", - syntaxes: [ - { - pattern: DEFAULT_PATTERN, - description: "Bounding paired delimiters.", - cheatsheet: "Bounding paired delimiters", - }, - ], - examples: [ - { - command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${PARENTHESES} ${TARGET}`, - description: `Selects only the parentheses containing the ${TARGET_DESC}.`, - }, - ], - }, - visible: { - name: "Visible", - defaultSpokenForm: "visible", - syntaxes: [ - { - pattern: DEFAULT_PATTERN, - description: "Visible in viewport.", - cheatsheet: "Visible in viewport", - }, - ], - examples: [ - { - command: `${SET_SELECTION} ${VAR_SPOKEN_FORM}`, - description: - "Selects the content currently visible in the editor viewport.", - }, - ], - }, + // Group: containing containingScope: { name: "Containing scope", + group: { id: "containing", index: 0 }, syntaxes: [ { pattern: VAR_SCOPE, @@ -140,6 +57,7 @@ export const modifierReferences = { everyScope: { name: "Every scope", defaultSpokenForm: EVERY, + group: { id: "containing", index: 1 }, syntaxes: [ { pattern: `${VAR_SPOKEN_FORM} ${VAR_SCOPE}`, @@ -157,6 +75,7 @@ export const modifierReferences = { ancestor: { name: "Ancestor", defaultSpokenForm: "grand", + group: { id: "containing", index: 2 }, syntaxes: [ { pattern: `${VAR_SPOKEN_FORM} ${VAR_SCOPE}`, @@ -171,8 +90,11 @@ export const modifierReferences = { }, ], }, + + // Group: ordinal ordinalScope: { name: "Ordinal scope", + group: { id: "ordinal", index: 0 }, syntaxes: [ { pattern: `${VAR_ORDINAL} ${VAR_SCOPE}`, @@ -237,8 +159,11 @@ export const modifierReferences = { }, ], }, + + // Group: relative relativeScope: { name: "Relative scope", + group: { id: "relative", index: 0 }, syntaxes: [ { pattern: `${PREVIOUS} ${VAR_SCOPE}`, @@ -370,9 +295,86 @@ export const modifierReferences = { }, ], }, + + // Group: delimiters + interiorOnly: { + name: "Interior only", + defaultSpokenForm: "inside", + group: { id: "delimiters", index: 0 }, + syntaxes: [ + { + pattern: DEFAULT_PATTERN, + description: "Interior only.", + cheatsheet: "Interior only", + }, + ], + examples: [ + { + command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${PARENTHESES} ${TARGET}`, + description: `Selects the contents of the parentheses containing the ${TARGET_DESC}, excluding the parentheses.`, + }, + ], + }, + excludeInterior: { + name: "Exclude interior", + defaultSpokenForm: "bounds", + group: { id: "delimiters", index: 1 }, + syntaxes: [ + { + pattern: DEFAULT_PATTERN, + description: "Bounding paired delimiters.", + cheatsheet: "Bounding paired delimiters", + }, + ], + examples: [ + { + command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${PARENTHESES} ${TARGET}`, + description: `Selects only the parentheses containing the ${TARGET_DESC}.`, + }, + ], + }, + leading: { + name: "Leading", + defaultSpokenForm: "leading", + group: { id: "delimiters", index: 2 }, + syntaxes: [ + { + pattern: DEFAULT_PATTERN, + description: "Leading delimiter range.", + cheatsheet: "Leading delimiter range", + }, + ], + examples: [ + { + command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${ITEM} ${TARGET}`, + description: `Selects the leading delimiter of the item containing the ${TARGET_DESC}.`, + }, + ], + }, + trailing: { + name: "Trailing", + defaultSpokenForm: "trailing", + group: { id: "delimiters", index: 3 }, + syntaxes: [ + { + pattern: DEFAULT_PATTERN, + description: "Trailing delimiter range.", + cheatsheet: "Trailing delimiter range", + }, + ], + examples: [ + { + command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${ITEM} ${TARGET}`, + description: `Selects the trailing delimiter of the item containing the ${TARGET_DESC}.`, + }, + ], + }, + + // Group: range extendThroughStartOf: { name: "Extend through start of", defaultSpokenForm: "head", + group: { id: "range", index: 0 }, syntaxes: [ { pattern: DEFAULT_PATTERN, @@ -399,6 +401,7 @@ export const modifierReferences = { extendThroughEndOf: { name: "Extend through end of", defaultSpokenForm: "tail", + group: { id: "range", index: 1 }, syntaxes: [ { pattern: DEFAULT_PATTERN, @@ -422,60 +425,69 @@ export const modifierReferences = { }, ], }, - leading: { - name: "Leading", - defaultSpokenForm: "leading", + + // Group: position + startOf: { + name: "Start of", + defaultSpokenForm: "start of", + group: { id: "position", index: 0 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Leading delimiter range.", - cheatsheet: "Leading delimiter range", + description: "Empty position at start of target.", + cheatsheet: "Empty position at start of target", }, ], examples: [ { - command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${ITEM} ${TARGET}`, - description: `Selects the leading delimiter of the item containing the ${TARGET_DESC}.`, + command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, + description: `Places the cursor at the start of the ${TARGET_DESC}.`, }, ], }, - trailing: { - name: "Trailing", - defaultSpokenForm: "trailing", + endOf: { + name: "End of", + defaultSpokenForm: "end of", + group: { id: "position", index: 1 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Trailing delimiter range.", - cheatsheet: "Trailing delimiter range", + description: "Empty position at end of target.", + cheatsheet: "Empty position at end of target", }, ], examples: [ { - command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${ITEM} ${TARGET}`, - description: `Selects the trailing delimiter of the item containing the ${TARGET_DESC}.`, + command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, + description: `Places the cursor at the end of the ${TARGET_DESC}.`, }, ], }, - toRawSelection: { - name: "Raw selection", - defaultSpokenForm: "just", + + // Group: filters + visible: { + name: "Visible", + defaultSpokenForm: "visible", + group: { id: "filters", index: 0 }, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "No inference.", - cheatsheet: "No inference", + description: "Visible in viewport.", + cheatsheet: "Visible in viewport", }, ], examples: [ { - command: `${REMOVE} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Deletes only the ${TARGET_DESC}, leaving adjacent whitespace unchanged.`, + command: `${SET_SELECTION} ${VAR_SPOKEN_FORM}`, + description: + "Selects the content currently visible in the editor viewport.", }, ], }, keepContentFilter: { name: "Keep content filter", defaultSpokenForm: "content", + group: { id: "filters", index: 1 }, syntaxes: [ { pattern: DEFAULT_PATTERN, @@ -494,6 +506,7 @@ export const modifierReferences = { keepEmptyFilter: { name: "Keep empty filter", defaultSpokenForm: "empty", + group: { id: "filters", index: 2 }, syntaxes: [ { pattern: DEFAULT_PATTERN, @@ -509,9 +522,30 @@ export const modifierReferences = { }, ], }, + + // Group: inference + toRawSelection: { + name: "Raw selection", + defaultSpokenForm: "just", + group: { id: "inference", index: 0 }, + syntaxes: [ + { + pattern: DEFAULT_PATTERN, + description: "No inference.", + cheatsheet: "No inference", + }, + ], + examples: [ + { + command: `${REMOVE} ${VAR_SPOKEN_FORM} ${TARGET}`, + description: `Deletes only the ${TARGET_DESC}, leaving adjacent whitespace unchanged.`, + }, + ], + }, inferPreviousMark: { name: "Infer previous mark", defaultSpokenForm: "its", + group: { id: "inference", index: 1 }, syntaxes: [ { pattern: DEFAULT_PATTERN, @@ -527,10 +561,11 @@ export const modifierReferences = { ], }, - // Private modifiers, but that has spoken forms + // Group: private preferredScope: { name: "Preferred scope", private: true, + group: { id: "private", index: 0 }, syntaxes: [ { pattern: VAR_SCOPE, @@ -545,27 +580,28 @@ export const modifierReferences = { }, ], }, - - // Modifiers without spoken forms modifyIfUntyped: { name: "Modify if untyped", private: true, + group: { id: "private", index: 1 }, syntaxes: [], examples: [], }, fallback: { name: "Fallback", private: true, + group: { id: "private", index: 2 }, syntaxes: [], examples: [], }, range: { name: "Range", private: true, + group: { id: "private", index: 3 }, syntaxes: [], examples: [], }, } as const satisfies Record< ModifierType | AdditionalModifierReferenceType, - ReferenceEntry + ReferenceEntry >; diff --git a/packages/lib-common/src/references/scopeReferenceGroups.ts b/packages/lib-common/src/references/scopeReferenceGroups.ts new file mode 100644 index 00000000000..8092f373518 --- /dev/null +++ b/packages/lib-common/src/references/scopeReferenceGroups.ts @@ -0,0 +1,52 @@ +import type { ReferenceGroup } from "./ReferenceEntry"; + +export type ScopeReferenceGroupId = + | "text" + | "sections" + | "documentHierarchy" + | "notebook" + | "collections" + | "functions" + | "objects" + | "statements" + | "markup" + | "private"; + +export const scopeReferenceGroups: ReferenceGroup[] = [ + { + id: "text", + name: "Text-based scopes", + }, + { + id: "sections", + name: "Sections", + }, + { + id: "documentHierarchy", + name: "Document hierarchy", + }, + { + id: "collections", + name: "Collections", + }, + { + id: "functions", + name: "Functions and calls", + }, + { + id: "objects", + name: "Classes and objects", + }, + { + id: "statements", + name: "Statements and expressions", + }, + { + id: "markup", + name: "Markup and styles", + }, + { + id: "notebook", + name: "Notebook", + }, +]; diff --git a/packages/lib-common/src/references/scopeReferences.ts b/packages/lib-common/src/references/scopeReferences.ts index 8db034e79e7..05cfcba8ff2 100644 --- a/packages/lib-common/src/references/scopeReferences.ts +++ b/packages/lib-common/src/references/scopeReferences.ts @@ -13,6 +13,7 @@ import { } from "./constants"; import { pairedDelimiterReferences } from "./pairedDelimiterReferences"; import type { ReferenceEntry } from "./ReferenceEntry"; +import type { ScopeReferenceGroupId } from "./scopeReferenceGroups"; import { connectiveDefaultSpokenForms } from "./spokenForms/connectiveDefaultSpokenForms"; import { graphemeDefaultSpokenForms } from "./spokenForms/graphemeDefaultSpokenForms"; @@ -24,1057 +25,1145 @@ const NEXT = connectiveDefaultSpokenForms.next; const FIRST = connectiveDefaultSpokenForms.first; export const scopeReferences = { - argumentOrParameter: { - name: "Argument or parameter", - defaultSpokenForm: "arg", + // Group: text + character: { + name: "Character", + group: { id: "text", index: 0 }, + defaultSpokenForm: "char", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Argument.", - cheatsheet: "Argument", + description: "Single character within a token.", + cheatsheet: "Character", }, ], examples: [ { - command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the argument or parameter containing the ${TARGET_DESC}.`, + command: `${SET_SELECTION} ${FIRST} ${VAR_SPOKEN_FORM} ${TARGET}`, + description: `Selects the first character in the ${TARGET_DESC}.`, }, ], }, - argumentList: { - name: "Argument list", - defaultSpokenForm: "arg list", + word: { + name: "Sub token word", + group: { id: "text", index: 1 }, + defaultSpokenForm: "sub", + legacySpokenForms: ["word"], syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Argument list.", - cheatsheet: "Argument list", + description: + "Word-like component within a token, such as part of camelCase or snake_case.", + cheatsheet: "Sub token word", }, ], examples: [ { - command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the argument list containing the ${TARGET_DESC}.`, + command: `${SET_SELECTION} ${FIRST} ${VAR_SPOKEN_FORM} ${TARGET}`, + description: `Selects the first sub token word in the ${TARGET_DESC}.`, }, ], }, - anonymousFunction: { - name: "Anonymous function", - defaultSpokenForm: "lambda", + token: { + name: "Token", + group: { id: "text", index: 2 }, + defaultSpokenForm: "token", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Anonymous function.", - cheatsheet: "Anonymous function", + description: "Token such as a word, number, or operator.", + cheatsheet: "Token", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the anonymous function containing the ${TARGET_DESC}.`, + description: `Selects the ${TARGET_DESC}.`, }, ], }, - attribute: { - name: "Attribute", - defaultSpokenForm: "attribute", + identifier: { + name: "Identifier", + group: { id: "text", index: 3 }, + defaultSpokenForm: "identifier", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Attribute.", - cheatsheet: "Attribute", + description: + "Identifier-style sequence, such as camelCase, snake_case, or kebab-case.", + cheatsheet: "Identifier", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the attribute containing the ${TARGET_DESC}.`, + description: `Selects the identifier containing the ${TARGET_DESC}.`, }, ], }, - branch: { - name: "Branch", - defaultSpokenForm: "branch", + sentence: { + name: "Sentence", + group: { id: "text", index: 4 }, + defaultSpokenForm: "sentence", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Branch.", - cheatsheet: "Branch", + description: + "Text ending at sentence punctuation or a paragraph boundary.", + cheatsheet: "Sentence", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the branch containing the ${TARGET_DESC}.`, + description: `Selects the sentence containing the ${TARGET_DESC}.`, }, ], }, - class: { - name: "Class", - defaultSpokenForm: "class", + line: { + name: "Line", + group: { id: "text", index: 5 }, + defaultSpokenForm: LINE, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Class.", - cheatsheet: "Class", + description: "Line, without indentation.", + cheatsheet: "Line", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the class containing the ${TARGET_DESC}.`, + description: `Selects the line containing the ${TARGET_DESC}.`, }, ], }, - className: { - name: "Class name", - defaultSpokenForm: "class name", + fullLine: { + name: "Full line", + group: { id: "text", index: 6 }, + defaultSpokenForm: "full line", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Class name.", - cheatsheet: "Class name", + description: "Full line, including indentation.", + cheatsheet: "Full line", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the class name containing the ${TARGET_DESC}.`, + description: `Selects the full line containing the ${TARGET_DESC}.`, }, ], }, - collectionItem: { - name: "Collection item", - defaultSpokenForm: ITEM, + paragraph: { + name: "Paragraph", + group: { id: "text", index: 7 }, + defaultSpokenForm: "block", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Collection item.", - cheatsheet: "Collection item", + description: "Paragraph, contiguous non-empty lines around the target.", + cheatsheet: "Paragraph", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the collection item containing the ${TARGET_DESC}.`, + description: `Selects the paragraph containing the ${TARGET_DESC}.`, }, ], }, - collectionKey: { - name: "Collection key", - defaultSpokenForm: "key", + boundedParagraph: { + name: "Bounded paragraph", + group: { id: "text", index: 8 }, + defaultSpokenForm: "short block", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Collection key.", - cheatsheet: "Collection key", + description: "Paragraph bounded by surrounding pair delimiters.", + cheatsheet: "Paragraph bounded by surrounding pair delimiters", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the collection key containing the ${TARGET_DESC}.`, + description: `Selects the bounded paragraph containing the ${TARGET_DESC}.`, }, ], }, - comment: { - name: "Comment", - defaultSpokenForm: "comment", + document: { + name: "Document", + group: { id: "text", index: 9 }, + defaultSpokenForm: "file", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Comment.", - cheatsheet: "Comment", + description: "Entire document.", + cheatsheet: "Document", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the comment containing the ${TARGET_DESC}.`, + description: `Selects the document containing the ${TARGET_DESC}.`, }, ], }, - functionCall: { - name: "Function call", - defaultSpokenForm: "call", + nonWhitespaceSequence: { + name: "Non-whitespace sequence", + group: { id: "text", index: 10 }, + defaultSpokenForm: "paint", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Function call.", - cheatsheet: "Function call", + description: "Non-whitespace sequence.", + cheatsheet: "Non-whitespace sequence", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the function call containing the ${TARGET_DESC}.`, + description: `Selects the non-whitespace sequence containing the ${TARGET_DESC}.`, }, ], }, - functionCallee: { - name: "Function callee", - defaultSpokenForm: "callee", + boundedNonWhitespaceSequence: { + name: "Bounded non-whitespace sequence", + group: { id: "text", index: 11 }, + defaultSpokenForm: "short paint", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Function callee.", - cheatsheet: "Function callee", + description: + "Non-whitespace sequence bounded by surrounding pair delimiters.", + cheatsheet: + "Non-whitespace sequence bounded by surrounding pair delimiters", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the function callee containing the ${TARGET_DESC}.`, + description: `Selects the bounded non-whitespace sequence containing the ${TARGET_DESC}.`, }, ], }, - functionName: { - name: "Function name", - defaultSpokenForm: "funk name", + url: { + name: "URL", + group: { id: "text", index: 12 }, + defaultSpokenForm: "link", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Function name.", - cheatsheet: "Function name", + description: "URL / Web address.", + cheatsheet: "URL", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the function name containing the ${TARGET_DESC}.`, + description: `Selects the url containing the ${TARGET_DESC}.`, }, ], }, - ifStatement: { - name: "If statement", - defaultSpokenForm: "if state", + surroundingPair: { + name: "Surrounding pair", + group: { id: "text", index: 13 }, syntaxes: [ { - pattern: DEFAULT_PATTERN, - description: "If statement.", - cheatsheet: "If statement", + pattern: VAR_PAIR, + description: "Surrounding matching delimiter pair and its contents.", + cheatsheet: "Surrounding pair", }, ], examples: [ { - command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the if statement containing the ${TARGET_DESC}.`, + command: `${SET_SELECTION} ${PARENTHESIS} ${TARGET}`, + description: `Selects the parentheses containing the ${TARGET_DESC}.`, }, ], }, - instance: { - name: "Instance", - defaultSpokenForm: "instance", + glyph: { + name: "Glyph", + group: { id: "text", index: 14 }, + defaultSpokenForm: "glyph", syntaxes: [ { - pattern: DEFAULT_PATTERN, - description: "Instance.", - cheatsheet: "Instance", + pattern: `${VAR_SPOKEN_FORM} ${VAR_CHARACTER}`, + description: `Instance of single character ${VAR_CHARACTER}.`, + cheatsheet: `Instance of single character ${VAR_CHARACTER}`, }, ], examples: [ { - command: `${SET_SELECTION} ${EVERY} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects every instance of the ${TARGET_DESC}.`, + command: `${SET_SELECTION} ${NEXT} ${VAR_SPOKEN_FORM} ${AIR}`, + description: `Selects the next 'a'.`, }, ], }, - list: { - name: "List", - defaultSpokenForm: "list", + + // Group: sections + section: { + name: "Section", + group: { id: "sections", index: 0 }, + defaultSpokenForm: "section", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "List.", - cheatsheet: "List", + description: + "Heading and its content through the next heading of the same or higher level.", + cheatsheet: "Section", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the list containing the ${TARGET_DESC}.`, + description: `Selects the section containing the ${TARGET_DESC}.`, }, ], }, - map: { - name: "Map", - defaultSpokenForm: "map", + sectionLevelOne: { + name: "Section level one", + group: { id: "sections", index: 1 }, + defaultSpokenForm: "one section", + disabledByDefault: true, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Map.", - cheatsheet: "Map", + description: "Level-one heading and its content.", + cheatsheet: "Section level one", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the map containing the ${TARGET_DESC}.`, + description: `Selects the section level one containing the ${TARGET_DESC}.`, }, ], }, - name: { - name: "Name", - defaultSpokenForm: "name", + sectionLevelTwo: { + name: "Section level two", + group: { id: "sections", index: 2 }, + defaultSpokenForm: "two section", + disabledByDefault: true, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Name.", - cheatsheet: "Name", + description: "Level-two heading and its content.", + cheatsheet: "Section level two", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the name containing the ${TARGET_DESC}.`, + description: `Selects the section level two containing the ${TARGET_DESC}.`, }, ], }, - namedFunction: { - name: "Named function", - defaultSpokenForm: "funk", + sectionLevelThree: { + name: "Section level three", + group: { id: "sections", index: 3 }, + defaultSpokenForm: "three section", + disabledByDefault: true, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Named function.", - cheatsheet: "Named function", + description: "Level-three heading and its content.", + cheatsheet: "Section level three", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the named function containing the ${TARGET_DESC}.`, + description: `Selects the section level three containing the ${TARGET_DESC}.`, }, ], }, - regularExpression: { - name: "Regular expression", - defaultSpokenForm: "regex", + sectionLevelFour: { + name: "Section level four", + group: { id: "sections", index: 4 }, + defaultSpokenForm: "four section", + disabledByDefault: true, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Regular expression.", - cheatsheet: "Regular expression", + description: "Level-four heading and its content.", + cheatsheet: "Section level four", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the regular expression containing the ${TARGET_DESC}.`, + description: `Selects the section level four containing the ${TARGET_DESC}.`, }, ], }, - statement: { - name: "Statement", - defaultSpokenForm: STATEMENT, + sectionLevelFive: { + name: "Section level five", + group: { id: "sections", index: 5 }, + defaultSpokenForm: "five section", + disabledByDefault: true, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Statement.", - cheatsheet: "Statement", + description: "Level-five heading and its content.", + cheatsheet: "Section level five", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the statement containing the ${TARGET_DESC}.`, + description: `Selects the section level five containing the ${TARGET_DESC}.`, }, ], }, - type: { - name: "Type", - defaultSpokenForm: "type", + sectionLevelSix: { + name: "Section level six", + group: { id: "sections", index: 6 }, + defaultSpokenForm: "six section", + disabledByDefault: true, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Type.", - cheatsheet: "Type", + description: "Level-six heading and its content.", + cheatsheet: "Section level six", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the type containing the ${TARGET_DESC}.`, + description: `Selects the section level six containing the ${TARGET_DESC}.`, }, ], }, - value: { - name: "Value", - defaultSpokenForm: "value", + + // Group: documentHierarchy + part: { + name: "Part", + group: { id: "documentHierarchy", index: 0 }, + defaultSpokenForm: "part", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Value.", - cheatsheet: "Value", + description: "Document part and its contents.", + cheatsheet: "Part", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the value containing the ${TARGET_DESC}.`, + description: `Selects the part containing the ${TARGET_DESC}.`, }, ], }, - condition: { - name: "Condition", - defaultSpokenForm: "condition", + chapter: { + name: "Chapter", + group: { id: "documentHierarchy", index: 1 }, + defaultSpokenForm: "chapter", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Condition.", - cheatsheet: "Condition", + description: "Document chapter and its contents.", + cheatsheet: "Chapter", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the condition containing the ${TARGET_DESC}.`, + description: `Selects the chapter containing the ${TARGET_DESC}.`, }, ], }, - section: { - name: "Section", - defaultSpokenForm: "section", + subSection: { + name: "Subsection", + group: { id: "documentHierarchy", index: 2 }, + defaultSpokenForm: "subsection", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Section.", - cheatsheet: "Section", + description: "Document subsection and its contents.", + cheatsheet: "Subsection", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the section containing the ${TARGET_DESC}.`, + description: `Selects the subsection containing the ${TARGET_DESC}.`, }, ], }, - sectionLevelOne: { - name: "Section level one", - defaultSpokenForm: "one section", - disabledByDefault: true, + subSubSection: { + name: "Subsubsection", + group: { id: "documentHierarchy", index: 3 }, + defaultSpokenForm: "subsubsection", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Section level one.", - cheatsheet: "Section level one", + description: "Document subsubsection and its contents.", + cheatsheet: "Subsubsection", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the section level one containing the ${TARGET_DESC}.`, + description: `Selects the subsubsection containing the ${TARGET_DESC}.`, }, ], }, - sectionLevelTwo: { - name: "Section level two", - defaultSpokenForm: "two section", - disabledByDefault: true, + namedParagraph: { + name: "Named paragraph", + group: { id: "documentHierarchy", index: 4 }, + defaultSpokenForm: "paragraph", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Section level two.", - cheatsheet: "Section level two", + description: "Named document paragraph and its contents.", + cheatsheet: "Named paragraph", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the section level two containing the ${TARGET_DESC}.`, + description: `Selects the named paragraph containing the ${TARGET_DESC}.`, }, ], }, - sectionLevelThree: { - name: "Section level three", - defaultSpokenForm: "three section", - disabledByDefault: true, + subParagraph: { + name: "Subparagraph", + group: { id: "documentHierarchy", index: 5 }, + defaultSpokenForm: "subparagraph", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Section level three.", - cheatsheet: "Section level three", + description: "Document subparagraph and its contents.", + cheatsheet: "Subparagraph", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the section level three containing the ${TARGET_DESC}.`, + description: `Selects the subparagraph containing the ${TARGET_DESC}.`, }, ], }, - sectionLevelFour: { - name: "Section level four", - defaultSpokenForm: "four section", - disabledByDefault: true, + environment: { + name: "Environment", + group: { id: "documentHierarchy", index: 6 }, + defaultSpokenForm: "environment", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Section level four.", - cheatsheet: "Section level four", + description: "Named document environment and its contents.", + cheatsheet: "Environment", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the section level four containing the ${TARGET_DESC}.`, + description: `Selects the environment containing the ${TARGET_DESC}.`, }, ], }, - sectionLevelFive: { - name: "Section level five", - defaultSpokenForm: "five section", - disabledByDefault: true, + + // Group: collections + list: { + name: "List", + group: { id: "collections", index: 0 }, + defaultSpokenForm: "list", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Section level five.", - cheatsheet: "Section level five", + description: "List or array.", + cheatsheet: "List", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the section level five containing the ${TARGET_DESC}.`, + description: `Selects the list containing the ${TARGET_DESC}.`, }, ], }, - sectionLevelSix: { - name: "Section level six", - defaultSpokenForm: "six section", - disabledByDefault: true, + map: { + name: "Map", + group: { id: "collections", index: 1 }, + defaultSpokenForm: "map", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Section level six.", - cheatsheet: "Section level six", + description: "Map, object, or dictionary.", + cheatsheet: "Map", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the section level six containing the ${TARGET_DESC}.`, + description: `Selects the map containing the ${TARGET_DESC}.`, }, ], }, - selector: { - name: "Selector", - defaultSpokenForm: "selector", + collectionItem: { + name: "Collection item", + group: { id: "collections", index: 2 }, + defaultSpokenForm: ITEM, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Selector.", - cheatsheet: "Selector", + description: "Entry in a list, map, object, or similar collection.", + cheatsheet: "Collection item", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the selector containing the ${TARGET_DESC}.`, + description: `Selects the collection item containing the ${TARGET_DESC}.`, }, ], }, - unit: { - name: "Unit", - defaultSpokenForm: "unit", + collectionKey: { + name: "Collection key", + group: { id: "collections", index: 3 }, + defaultSpokenForm: "key", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Unit.", - cheatsheet: "Unit", + description: "Key in a map, object, or dictionary.", + cheatsheet: "Collection key", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the unit containing the ${TARGET_DESC}.`, + description: `Selects the collection key containing the ${TARGET_DESC}.`, }, ], }, - xmlBothTags: { - name: "XML both tags", - defaultSpokenForm: "tags", + + // Group: functions + argumentOrParameter: { + name: "Argument or parameter", + group: { id: "functions", index: 0 }, + defaultSpokenForm: "arg", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "XML start and end tags.", - cheatsheet: "XML start and end tags", + description: "Function parameter or function-call argument.", + cheatsheet: "Argument", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects both tags of the XML element containing the ${TARGET_DESC}.`, + description: `Selects the argument or parameter containing the ${TARGET_DESC}.`, }, ], }, - xmlElement: { - name: "XML element", - defaultSpokenForm: "element", + argumentList: { + name: "Argument list", + group: { id: "functions", index: 1 }, + defaultSpokenForm: "arg list", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "XML element.", - cheatsheet: "XML element", + description: "Complete parameter or argument list.", + cheatsheet: "Argument list", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the XML element containing the ${TARGET_DESC}.`, + description: `Selects the argument list containing the ${TARGET_DESC}.`, }, ], }, - xmlEndTag: { - name: "XML end tag", - defaultSpokenForm: "end tag", + anonymousFunction: { + name: "Anonymous function", + group: { id: "functions", index: 2 }, + defaultSpokenForm: "lambda", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "XML end tag.", - cheatsheet: "XML end tag", + description: "Anonymous or lambda function.", + cheatsheet: "Anonymous function", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the XML end tag containing the ${TARGET_DESC}.`, + description: `Selects the anonymous function containing the ${TARGET_DESC}.`, }, ], }, - xmlStartTag: { - name: "XML start tag", - defaultSpokenForm: "start tag", + namedFunction: { + name: "Named function", + group: { id: "functions", index: 3 }, + defaultSpokenForm: "funk", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "XML start tag.", - cheatsheet: "XML start tag", + description: "Named function declaration.", + cheatsheet: "Named function", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the XML start tag containing the ${TARGET_DESC}.`, + description: `Selects the named function containing the ${TARGET_DESC}.`, }, ], }, - part: { - name: "Part", - defaultSpokenForm: "part", + functionName: { + name: "Function name", + group: { id: "functions", index: 4 }, + defaultSpokenForm: "funk name", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Part.", - cheatsheet: "Part", + description: "Name in a function declaration.", + cheatsheet: "Function name", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the part containing the ${TARGET_DESC}.`, + description: `Selects the function name containing the ${TARGET_DESC}.`, }, ], }, - chapter: { - name: "Chapter", - defaultSpokenForm: "chapter", + functionCall: { + name: "Function call", + group: { id: "functions", index: 5 }, + defaultSpokenForm: "call", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Chapter.", - cheatsheet: "Chapter", + description: "Function, method, or constructor call.", + cheatsheet: "Function call", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the chapter containing the ${TARGET_DESC}.`, + description: `Selects the function call containing the ${TARGET_DESC}.`, }, ], }, - subSection: { - name: "Subsection", - defaultSpokenForm: "subsection", + functionCallee: { + name: "Function callee", + group: { id: "functions", index: 6 }, + defaultSpokenForm: "callee", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Subsection.", - cheatsheet: "Subsection", + description: "Expression invoked by a function call.", + cheatsheet: "Function callee", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the subsection containing the ${TARGET_DESC}.`, + description: `Selects the function callee containing the ${TARGET_DESC}.`, }, ], }, - subSubSection: { - name: "Subsubsection", - defaultSpokenForm: "subsubsection", + + // Group: objects + class: { + name: "Class", + group: { id: "objects", index: 0 }, + defaultSpokenForm: "class", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Subsubsection.", - cheatsheet: "Subsubsection", + description: "Class or struct declaration or definition.", + cheatsheet: "Class", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the subsubsection containing the ${TARGET_DESC}.`, + description: `Selects the class containing the ${TARGET_DESC}.`, }, ], }, - namedParagraph: { - name: "Named paragraph", - defaultSpokenForm: "paragraph", + className: { + name: "Class name", + group: { id: "objects", index: 1 }, + defaultSpokenForm: "class name", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Named paragraph.", - cheatsheet: "Named paragraph", + description: "Name in a class or struct declaration.", + cheatsheet: "Class name", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the named paragraph containing the ${TARGET_DESC}.`, + description: `Selects the class name containing the ${TARGET_DESC}.`, }, ], }, - subParagraph: { - name: "Subparagraph", - defaultSpokenForm: "subparagraph", + instance: { + name: "Instance", + group: { id: "objects", index: 2 }, + defaultSpokenForm: "instance", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Subparagraph.", - cheatsheet: "Subparagraph", + description: "Occurrence matching the current instance.", + cheatsheet: "Instance", }, ], examples: [ { - command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the subparagraph containing the ${TARGET_DESC}.`, + command: `${SET_SELECTION} ${EVERY} ${VAR_SPOKEN_FORM} ${TARGET}`, + description: `Selects every instance of the ${TARGET_DESC}.`, }, ], }, - environment: { - name: "Environment", - defaultSpokenForm: "environment", + name: { + name: "Name", + group: { id: "objects", index: 3 }, + defaultSpokenForm: "name", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Environment.", - cheatsheet: "Environment", + description: + "Name in a declaration, such as a variable or function name.", + cheatsheet: "Name", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the environment containing the ${TARGET_DESC}.`, + description: `Selects the name containing the ${TARGET_DESC}.`, }, ], }, - character: { - name: "Character", - defaultSpokenForm: "char", + attribute: { + name: "Attribute", + group: { id: "objects", index: 4 }, + defaultSpokenForm: "attribute", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Character.", - cheatsheet: "Character", + description: "Attribute, such as one on an HTML element.", + cheatsheet: "Attribute", }, ], examples: [ { - command: `${SET_SELECTION} ${FIRST} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the first character in the ${TARGET_DESC}.`, + command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, + description: `Selects the attribute containing the ${TARGET_DESC}.`, }, ], }, - word: { - name: "Sub token word", - defaultSpokenForm: "sub", - legacySpokenForms: ["word"], + type: { + name: "Type", + group: { id: "objects", index: 5 }, + defaultSpokenForm: "type", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Sub token word.", - cheatsheet: "Sub token word", + description: "Type annotation or declaration.", + cheatsheet: "Type", }, ], examples: [ { - command: `${SET_SELECTION} ${FIRST} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the first sub token word in the ${TARGET_DESC}.`, + command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, + description: `Selects the type containing the ${TARGET_DESC}.`, }, ], }, - token: { - name: "Token", - defaultSpokenForm: "token", + value: { + name: "Value", + group: { id: "objects", index: 6 }, + defaultSpokenForm: "value", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Token.", - cheatsheet: "Token", + description: + "Value in an assignment, collection entry, return statement, or similar construct.", + cheatsheet: "Value", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the ${TARGET_DESC}.`, + description: `Selects the value containing the ${TARGET_DESC}.`, }, ], }, - identifier: { - name: "Identifier", - defaultSpokenForm: "identifier", + + // Group: statements + statement: { + name: "Statement", + group: { id: "statements", index: 0 }, + defaultSpokenForm: STATEMENT, syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Identifier.", - cheatsheet: "Identifier", + description: + "Complete statement, such as a variable declaration or expression statement.", + cheatsheet: "Statement", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the identifier containing the ${TARGET_DESC}.`, + description: `Selects the statement containing the ${TARGET_DESC}.`, }, ], }, - line: { - name: "Line", - defaultSpokenForm: LINE, + branch: { + name: "Branch", + group: { id: "statements", index: 1 }, + defaultSpokenForm: "branch", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Line.", - cheatsheet: "Line", + description: + "Branch of a control-flow construct, such as if, try, switch, or ternary.", + cheatsheet: "Branch", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the line containing the ${TARGET_DESC}.`, + description: `Selects the branch containing the ${TARGET_DESC}.`, }, ], }, - fullLine: { - name: "Full line", - defaultSpokenForm: "full line", + ifStatement: { + name: "If statement", + group: { id: "statements", index: 2 }, + defaultSpokenForm: "if state", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Full line.", - cheatsheet: "Full line", + description: "Complete if statement.", + cheatsheet: "If statement", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the full line containing the ${TARGET_DESC}.`, + description: `Selects the if statement containing the ${TARGET_DESC}.`, }, ], }, - sentence: { - name: "Sentence", - defaultSpokenForm: "sentence", + condition: { + name: "Condition", + group: { id: "statements", index: 3 }, + defaultSpokenForm: "condition", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Sentence.", - cheatsheet: "Sentence", + description: "Condition of a conditional, loop, or similar construct.", + cheatsheet: "Condition", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the sentence containing the ${TARGET_DESC}.`, + description: `Selects the condition containing the ${TARGET_DESC}.`, }, ], }, - paragraph: { - name: "Paragraph", - defaultSpokenForm: "block", + comment: { + name: "Comment", + group: { id: "statements", index: 4 }, + defaultSpokenForm: "comment", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Paragraph.", - cheatsheet: "Paragraph", + description: "Line or block comment.", + cheatsheet: "Comment", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the paragraph containing the ${TARGET_DESC}.`, + description: `Selects the comment containing the ${TARGET_DESC}.`, }, ], }, - boundedParagraph: { - name: "Bounded paragraph", - defaultSpokenForm: "short block", + command: { + name: "Command", + group: { id: "statements", index: 5 }, + defaultSpokenForm: "command", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Paragraph bounded by surrounding pair delimiters.", - cheatsheet: "Paragraph bounded by surrounding pair delimiters", + description: + "Command, such as a Talon spoken command or shell command.", + cheatsheet: "Command", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the bounded paragraph containing the ${TARGET_DESC}.`, + description: `Selects the command containing the ${TARGET_DESC}.`, }, ], }, - document: { - name: "Document", - defaultSpokenForm: "file", + regularExpression: { + name: "Regular expression", + group: { id: "statements", index: 6 }, + defaultSpokenForm: "regex", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Document.", - cheatsheet: "Document", + description: "Regular-expression literal.", + cheatsheet: "Regular expression", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the document containing the ${TARGET_DESC}.`, + description: `Selects the regular expression containing the ${TARGET_DESC}.`, }, ], }, - nonWhitespaceSequence: { - name: "Non-whitespace sequence", - defaultSpokenForm: "paint", + + // Group: markup + xmlElement: { + name: "XML element", + group: { id: "markup", index: 0 }, + defaultSpokenForm: "element", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Non-whitespace sequence.", - cheatsheet: "Non-whitespace sequence", + description: + "Complete XML, HTML, or JSX element, or a LaTeX environment.", + cheatsheet: "XML element", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the non-whitespace sequence containing the ${TARGET_DESC}.`, + description: `Selects the XML element containing the ${TARGET_DESC}.`, }, ], }, - boundedNonWhitespaceSequence: { - name: "Bounded non-whitespace sequence", - nameShort: "Bounded non-ws sequence", - defaultSpokenForm: "short paint", + xmlStartTag: { + name: "XML start tag", + group: { id: "markup", index: 1 }, + defaultSpokenForm: "start tag", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: - "Non-whitespace sequence bounded by surrounding pair delimiters.", - cheatsheet: - "Non-whitespace sequence bounded by surrounding pair delimiters", + description: "Opening XML, HTML, or JSX tag, or LaTeX `begin` command.", + cheatsheet: "XML start tag", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the bounded non-whitespace sequence containing the ${TARGET_DESC}.`, + description: `Selects the XML start tag containing the ${TARGET_DESC}.`, }, ], }, - url: { - name: "URL", - defaultSpokenForm: "link", + xmlEndTag: { + name: "XML end tag", + group: { id: "markup", index: 2 }, + defaultSpokenForm: "end tag", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "URL.", - cheatsheet: "URL", + description: "Closing XML, HTML, or JSX tag, or LaTeX `end` command.", + cheatsheet: "XML end tag", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the url containing the ${TARGET_DESC}.`, + description: `Selects the XML end tag containing the ${TARGET_DESC}.`, }, ], }, - notebookCell: { - name: "Notebook cell", - defaultSpokenForm: "cell", + xmlBothTags: { + name: "XML both tags", + group: { id: "markup", index: 3 }, + defaultSpokenForm: "tags", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Notebook cell.", - cheatsheet: "Notebook cell", + description: + "Opening and closing XML, HTML, or JSX tags, or LaTeX `begin` and `end` commands.", + cheatsheet: "XML start and end tags", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the notebook cell containing the ${TARGET_DESC}.`, + description: `Selects both tags of the XML element containing the ${TARGET_DESC}.`, }, ], }, - command: { - name: "Command", - defaultSpokenForm: "command", + selector: { + name: "Selector", + group: { id: "markup", index: 4 }, + defaultSpokenForm: "selector", syntaxes: [ { pattern: DEFAULT_PATTERN, - description: "Command.", - cheatsheet: "Command", + description: "CSS selector.", + cheatsheet: "Selector", }, ], examples: [ { command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, - description: `Selects the command containing the ${TARGET_DESC}.`, + description: `Selects the selector containing the ${TARGET_DESC}.`, }, ], }, - glyph: { - name: "Glyph", - defaultSpokenForm: "glyph", + unit: { + name: "Unit", + group: { id: "markup", index: 5 }, + defaultSpokenForm: "unit", syntaxes: [ { - pattern: `${VAR_SPOKEN_FORM} ${VAR_CHARACTER}`, - description: `Instance of single character ${VAR_CHARACTER}.`, - cheatsheet: `Instance of single character ${VAR_CHARACTER}`, + pattern: DEFAULT_PATTERN, + description: "Unit suffix in a measurement, such as `px` in `100px`.", + cheatsheet: "Unit", }, ], examples: [ { - command: `${SET_SELECTION} ${NEXT} ${VAR_SPOKEN_FORM} ${AIR}`, - description: `Selects the next 'a'.`, + command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, + description: `Selects the unit containing the ${TARGET_DESC}.`, }, ], }, - surroundingPair: { - name: "Surrounding pair", + + // Group: notebook + notebookCell: { + name: "Notebook cell", + group: { id: "notebook", index: 0 }, + defaultSpokenForm: "cell", syntaxes: [ { - pattern: VAR_PAIR, - description: "Surrounding pair.", - cheatsheet: "Surrounding pair", + pattern: DEFAULT_PATTERN, + description: "Notebook cell or Markdown fenced code block.", + cheatsheet: "Notebook cell", }, ], examples: [ { - command: `${SET_SELECTION} ${PARENTHESIS} ${TARGET}`, - description: `Selects the parentheses containing the ${TARGET_DESC}.`, + command: `${SET_SELECTION} ${VAR_SPOKEN_FORM} ${TARGET}`, + description: `Selects the notebook cell containing the ${TARGET_DESC}.`, }, ], }, - // Private scopes -------------------- - + // Group: private "private.fieldAccess": { name: "Field access", + group: { id: "private", index: 0 }, defaultSpokenForm: "access", private: true, syntaxes: [ @@ -1093,6 +1182,7 @@ export const scopeReferences = { }, string: { name: "String", + group: { id: "private", index: 1 }, defaultSpokenForm: "parse tree string", private: true, syntaxes: [ @@ -1111,6 +1201,7 @@ export const scopeReferences = { }, textFragment: { name: "Text fragment", + group: { id: "private", index: 2 }, defaultSpokenForm: "text fragment", private: true, syntaxes: [ @@ -1129,6 +1220,7 @@ export const scopeReferences = { }, disqualifyDelimiter: { name: "Disqualify delimiter", + group: { id: "private", index: 3 }, defaultSpokenForm: "disqualify delimiter", private: true, syntaxes: [ @@ -1147,6 +1239,7 @@ export const scopeReferences = { }, pairDelimiter: { name: "Pair delimiter", + group: { id: "private", index: 4 }, defaultSpokenForm: "pair delimiter", private: true, syntaxes: [ @@ -1165,6 +1258,7 @@ export const scopeReferences = { }, interior: { name: "Interior", + group: { id: "private", index: 5 }, defaultSpokenForm: "interior", private: true, syntaxes: [ @@ -1183,14 +1277,19 @@ export const scopeReferences = { }, surroundingPairInterior: { name: "Surrounding pair interior", + group: { id: "private", index: 6 }, private: true, syntaxes: [], examples: [], }, customRegex: { name: "Custom regex", + group: { id: "private", index: 7 }, private: true, syntaxes: [], examples: [], }, -} as const satisfies Record; +} as const satisfies Record< + ScopeTypeType, + ReferenceEntry +>; diff --git a/packages/tool-meta-updater/src/metaUpdater.ts b/packages/tool-meta-updater/src/metaUpdater.ts index dd773f704ca..953e34e80d6 100644 --- a/packages/tool-meta-updater/src/metaUpdater.ts +++ b/packages/tool-meta-updater/src/metaUpdater.ts @@ -6,9 +6,12 @@ import { readWantedLockfile } from "@pnpm/lockfile-file"; import { createUpdateOptions } from "@pnpm/meta-updater"; import { + actionReferenceGroups, actionReferences, languageScopeSupport, + modifierReferenceGroups, modifierReferences, + scopeReferenceGroups, scopeReferences, } from "@cursorless/lib-common"; import type { Context } from "./Context"; @@ -17,9 +20,11 @@ import { updateLanguageMdx } from "./updateLanguageMdx"; import { updatePackageJson } from "./updatePackageJson"; import { updatePrivateScopeMdx } from "./updatePrivateScopeMdx"; import { updateReferenceMdx } from "./updateReferenceMdx"; -import { updatesScopeSupportFacetInfos } from "./updatesScopeSupportFacetInfos"; +import { updateReferenceReadmeMd } from "./updateReferenceReadmeMd"; +import { updateScopeSupportFacetInfos } from "./updateScopeSupportFacetInfos"; import { updateTSConfig } from "./updateTSConfig"; import { updateTSConfigBase } from "./updateTSConfigBase"; +import { cleanId } from "./util/cleanId"; export const updater = async (workspaceDir: string) => { const pnpmLockfile = await readWantedLockfile(workspaceDir, { @@ -44,13 +49,31 @@ export const updater = async (workspaceDir: string) => { "tsconfig.json": updateTSConfig.bind(null, context), "tsconfig.base.json": updateTSConfigBase.bind(null, context), "resources/fixtures/scope-support-facet-infos.md": - updatesScopeSupportFacetInfos, + updateScopeSupportFacetInfos, ...Object.fromEntries( Object.keys(languageScopeSupport).map((languageId) => [ `${userDir}/languages/${languageId}.mdx`, updateLanguageMdx.bind(null, languageId), ]), ), + [`${userDir}/actions/README.md`]: updateReferenceReadmeMd.bind( + null, + "Actions", + actionReferences, + actionReferenceGroups, + ), + [`${userDir}/modifiers/README.md`]: updateReferenceReadmeMd.bind( + null, + "Modifiers", + modifierReferences, + modifierReferenceGroups, + ), + [`${userDir}/scopes/README.md`]: updateReferenceReadmeMd.bind( + null, + "Scopes", + scopeReferences, + scopeReferenceGroups, + ), ...Object.fromEntries( Object.entries(actionReferences).map(([id, entry]) => [ `${userDir}/actions/${cleanId(id)}.mdx`, @@ -82,7 +105,3 @@ export const updater = async (workspaceDir: string) => { }, }); }; - -function cleanId(id: string): string { - return id.replace("private.", "").replace("experimental.", ""); -} diff --git a/packages/tool-meta-updater/src/updatePackageJson.ts b/packages/tool-meta-updater/src/updatePackageJson.ts index d156df6b3c3..0968cd62ee8 100644 --- a/packages/tool-meta-updater/src/updatePackageJson.ts +++ b/packages/tool-meta-updater/src/updatePackageJson.ts @@ -3,7 +3,7 @@ import { isUndefined } from "lodash-es"; import type { PackageJson } from "type-fest"; import { omitByDeep } from "@cursorless/lib-common"; import type { Context } from "./Context"; -import { getCursorlessVscodeFields } from "./getCursorlessVscodeFields"; +import { getCursorlessVscodeFields } from "./util/getCursorlessVscodeFields"; const LIB_ENTRY_POINT = "./src/index.ts"; diff --git a/packages/tool-meta-updater/src/updatePrivateScopeMdx.ts b/packages/tool-meta-updater/src/updatePrivateScopeMdx.ts index cda49c0a466..0af55742de0 100644 --- a/packages/tool-meta-updater/src/updatePrivateScopeMdx.ts +++ b/packages/tool-meta-updater/src/updatePrivateScopeMdx.ts @@ -3,7 +3,7 @@ import type { ReferenceEntry } from "@cursorless/lib-common"; export function updatePrivateScopeMdx( id: string, - entry: ReferenceEntry, + entry: ReferenceEntry, actual: string | null, options: FormatPluginFnOptions, ): string | null { diff --git a/packages/tool-meta-updater/src/updateReferenceMdx.ts b/packages/tool-meta-updater/src/updateReferenceMdx.ts index c4ba9b0a769..826d2dc04af 100644 --- a/packages/tool-meta-updater/src/updateReferenceMdx.ts +++ b/packages/tool-meta-updater/src/updateReferenceMdx.ts @@ -1,13 +1,13 @@ import type { FormatPluginFnOptions } from "@pnpm/meta-updater"; import type { ReferenceEntry } from "@cursorless/lib-common"; import { capitalize } from "@cursorless/lib-common"; - -const VAR_SPOKEN_FORM = ""; +import { formatVariables } from "./util/formatVariables"; +import { injectSpokenForm } from "./util/injectSpokenForm"; export function updateReferenceMdx( kind: "action" | "modifier" | "scope", id: string, - entry: ReferenceEntry, + entry: ReferenceEntry, actual: string | null, options: FormatPluginFnOptions, ): string | null { @@ -75,9 +75,7 @@ export function updateReferenceMdx( const pattern = formatVariables( injectSpokenForm(syntax.pattern, entry.defaultSpokenForm), ); - const description = formatVariables( - injectSpokenForm(syntax.description, entry.defaultSpokenForm), - ); + const description = formatVariables(syntax.description); expected.push(`- ${pattern} - ${description}`); } expected.push(""); @@ -110,33 +108,6 @@ function bold(value: string) { return `**${value}**`; } -function injectSpokenForm( - pattern: string, - defaultSpokenForm: string | undefined, -): string { - if (defaultSpokenForm == null) { - if (pattern.includes(VAR_SPOKEN_FORM)) { - throw new Error( - `Pattern "${pattern}" contains ${VAR_SPOKEN_FORM}, but no defaultSpokenForm is provided`, - ); - } - return pattern; - } - return pattern.replace(VAR_SPOKEN_FORM, defaultSpokenForm); -} - -function formatVariables(pattern: string): string { - return pattern - .split(/(<[\w ]+>)/gu) - .map((part) => { - if (part.startsWith("<") && part.endsWith(">")) { - return code(part); - } - return part; - }) - .join(""); -} - function formatGroup(lines: string[]): string[] { return lines.map((line, index) => index < lines.length - 1 ? `${line}\\` : line, diff --git a/packages/tool-meta-updater/src/updateReferenceReadmeMd.ts b/packages/tool-meta-updater/src/updateReferenceReadmeMd.ts new file mode 100644 index 00000000000..8be2374d56f --- /dev/null +++ b/packages/tool-meta-updater/src/updateReferenceReadmeMd.ts @@ -0,0 +1,47 @@ +import type { FormatPluginFnOptions } from "@pnpm/meta-updater"; +import type { ReferenceEntry, ReferenceGroup } from "@cursorless/lib-common"; +import { cleanId } from "./util/cleanId"; +import { formatVariables } from "./util/formatVariables"; +import { injectSpokenForm } from "./util/injectSpokenForm"; + +export function updateReferenceReadmeMd( + title: string, + entries: Record>, + groups: ReferenceGroup[], + actual: string | null, + options: FormatPluginFnOptions, +): string | null { + if (options.manifest.name !== "@cursorless/app-web-docs") { + return null; + } + + const expected: string[] = [`# ${title}`, ""]; + + for (const group of groups) { + if (group.id === "private") { + continue; + } + + expected.push(`## ${group.name}`, ""); + + const groupEntries = Object.entries(entries) + .filter(([, entry]) => entry.group.id === group.id) + .toSorted(([, a], [, b]) => a.group.index - b.group.index); + + for (const [rawId, entry] of groupEntries) { + const id = cleanId(rawId); + for (const syntax of entry.syntaxes) { + const pattern = injectSpokenForm( + syntax.pattern, + entry.defaultSpokenForm, + ); + const description = formatVariables(syntax.description); + expected.push(`- [\`"${pattern}"\`](./${id}.mdx) - ${description}`); + } + } + + expected.push(""); + } + + return expected.join("\n"); +} diff --git a/packages/tool-meta-updater/src/updatesScopeSupportFacetInfos.ts b/packages/tool-meta-updater/src/updateScopeSupportFacetInfos.ts similarity index 96% rename from packages/tool-meta-updater/src/updatesScopeSupportFacetInfos.ts rename to packages/tool-meta-updater/src/updateScopeSupportFacetInfos.ts index 4c39aa4e44e..1866289a34e 100644 --- a/packages/tool-meta-updater/src/updatesScopeSupportFacetInfos.ts +++ b/packages/tool-meta-updater/src/updateScopeSupportFacetInfos.ts @@ -9,7 +9,7 @@ import { plaintextScopeSupportFacetInfos, } from "@cursorless/lib-common"; -export function updatesScopeSupportFacetInfos( +export function updateScopeSupportFacetInfos( actual: string | null, _options: FormatPluginFnOptions, ): string | null { diff --git a/packages/tool-meta-updater/src/updateTSConfig.ts b/packages/tool-meta-updater/src/updateTSConfig.ts index fc481c1ecfe..26014604404 100644 --- a/packages/tool-meta-updater/src/updateTSConfig.ts +++ b/packages/tool-meta-updater/src/updateTSConfig.ts @@ -5,7 +5,7 @@ import { isEqual } from "lodash-es"; import normalizePath from "normalize-path"; import type { TsConfigJson } from "type-fest"; import type { Context } from "./Context"; -import { toPosixPath } from "./toPosixPath"; +import { toPosixPath } from "./util/toPosixPath"; const baseName = "tsconfig.base.json"; const webJsonName = "tsconfig.web.json"; diff --git a/packages/tool-meta-updater/src/util/cleanId.ts b/packages/tool-meta-updater/src/util/cleanId.ts new file mode 100644 index 00000000000..8c16dc4a073 --- /dev/null +++ b/packages/tool-meta-updater/src/util/cleanId.ts @@ -0,0 +1,3 @@ +export function cleanId(id: string): string { + return id.replace("private.", "").replace("experimental.", ""); +} diff --git a/packages/tool-meta-updater/src/util/formatVariables.ts b/packages/tool-meta-updater/src/util/formatVariables.ts new file mode 100644 index 00000000000..1d8df518372 --- /dev/null +++ b/packages/tool-meta-updater/src/util/formatVariables.ts @@ -0,0 +1,11 @@ +export function formatVariables(pattern: string): string { + return pattern + .split(/(<[\w ]+>)/gu) + .map((part) => { + if (part.startsWith("<") && part.endsWith(">")) { + return `\`${part}\``; + } + return part; + }) + .join(""); +} diff --git a/packages/tool-meta-updater/src/getCursorlessVscodeFields.ts b/packages/tool-meta-updater/src/util/getCursorlessVscodeFields.ts similarity index 100% rename from packages/tool-meta-updater/src/getCursorlessVscodeFields.ts rename to packages/tool-meta-updater/src/util/getCursorlessVscodeFields.ts diff --git a/packages/tool-meta-updater/src/util/injectSpokenForm.ts b/packages/tool-meta-updater/src/util/injectSpokenForm.ts new file mode 100644 index 00000000000..f3ff8ddd0ec --- /dev/null +++ b/packages/tool-meta-updater/src/util/injectSpokenForm.ts @@ -0,0 +1,16 @@ +const VAR_SPOKEN_FORM = ""; + +export function injectSpokenForm( + pattern: string, + defaultSpokenForm: string | undefined, +): string { + if (defaultSpokenForm == null) { + if (pattern.includes(VAR_SPOKEN_FORM)) { + throw new Error( + `Pattern "${pattern}" contains ${VAR_SPOKEN_FORM}, but no defaultSpokenForm is provided`, + ); + } + return pattern; + } + return pattern.replace(VAR_SPOKEN_FORM, defaultSpokenForm); +} diff --git a/packages/tool-meta-updater/src/toPosixPath.ts b/packages/tool-meta-updater/src/util/toPosixPath.ts similarity index 100% rename from packages/tool-meta-updater/src/toPosixPath.ts rename to packages/tool-meta-updater/src/util/toPosixPath.ts