Skip to content

keyboard: Add support for rewrap - #3385

Merged
AndreasArvidsson merged 2 commits into
cursorless-dev:mainfrom
jay23606:pr-go/2423-keyboard-add-support-for-rewrap
Nov 16, 2026
Merged

AndreasArvidsson merged 2 commits into
cursorless-dev:mainfrom
jay23606:pr-go/2423-keyboard-add-support-for-rewrap

Conversation

@jay23606

Copy link
Copy Markdown
Contributor

Bug

Keyboard mode had a wrap action but no rewrap, so rewrap could not be bound to a keyboard key (issue #2423).

Change

  • rewrap is a keyboard action alongside wrap, and rewrapWithPairedDelimiter is excluded from the simple keyboard actions, since it is only reachable through the wrap path.
  • The name mapping from wrap/rewrap to the paired-delimiter command moved into getPairedDelimiterCommandName.ts, which has no vscode import, so the handler's choice is unit tested. KeyboardCommandHandler now calls it.
  • The rewrapWithPairedDelimiter case in KeyboardCommandsTargeted.performSimpleActionOnTarget was removed. Simple keyboard action tokens are built only from simpleKeyboardActionNames, which now excludes that action, so the case cannot be reached from keyboard input.

Testing

  • getPairedDelimiterCommandName.test.ts checks that wrap maps to wrapWithPairedDelimiter and rewrap maps to rewrapWithPairedDelimiter. It passes on this change (ℹ pass 2). On the base commit the helper module does not exist, so the test fails with ERR_MODULE_NOT_FOUND.
  • tsc --noEmit -p tsconfig.json for packages/app-vscode reports no type errors.
  • oxlint on packages/app-vscode/src/keyboard reports 0 warnings and 0 errors.
  • The VS Code extension test suite (test:vscode) was not run.

A new rewrap test case was added to grammar.test.ts (+16 lines).

Regression test: fails on base twice (/ERR_MODULE_NOT_FOUND|Cannot find module/), passes on fix twice (node_modules/.bin/tsx -e 'const t=require("node:test");Object.assign(globalThis,{suite:t.describe,test:t.it,setup:t.beforeEach});import("./packages/app-vscode/src/keyboard/getPairedDelimiterCommandName.test.ts")')

Fixes #2423

@jay23606
jay23606 requested a review from a team as a code owner November 15, 2026 11:35
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T11:39:07.475798Z b8be019 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b8be0197de

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

"unfoldRegion",
"wrap"
"wrap",
"rewrap"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove the stale ID from the structured action enum

When a user chooses the object-form keybinding { "actionId": "rewrapWithPairedDelimiter" }, this enum still marks it valid at line 1035, but KeyboardActionType.ts now excludes that ID and getTokenTypeKeyMaps accepts only wrap/rewrap, so KeyboardConfig.getTokenKeyMap silently drops the binding. The string branch was corrected in this commit; remove the old ID from this object branch too so VS Code does not advertise a configuration that creates a dead key.

Useful? React with 👍 / 👎.

@AndreasArvidsson

AndreasArvidsson commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

rewrapWithPairedDelimiter is already supported. rewrap is the abstraction we are using in Talon while rewrapWithPairedDelimiter is the action implementation in the Cursorless extension. Does it work for you to just use rewrapWithPairedDelimiter directly?

@jay23606

Copy link
Copy Markdown
Contributor Author

No code change in this round. Keyboard wrap already uses its short action id rather than wrapWithPairedDelimiter, so rewrap follows the same pattern, and getPairedDelimiterCommandName.ts maps it to rewrapWithPairedDelimiter.

@github-actions github-actions Bot added lines/50-199 Pull request changes 50 to 199 lines labels Nov 16, 2026
@AndreasArvidsson
AndreasArvidsson merged commit 3c77c47 into cursorless-dev:main Nov 16, 2026
18 checks passed
@jay23606
jay23606 deleted the pr-go/2423-keyboard-add-support-for-rewrap branch November 16, 2026 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lines/50-199 Pull request changes 50 to 199 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

keyboard: Add support for "rewrap"

2 participants