feat(ux): unify "Ask Claude to Edit" + inline prompt at selection; fix keybindings

Operator feedback on the Ask-Claude ergonomics (relates to #42/#43/#60):

- One user-facing command `cowriting.edit` ("Ask Claude to Edit") routes to the
  selection or whole-document flow at runtime via the pure `routeEdit` helper
  (selection → editSelection; none / tab right-click → editDocument). The two
  underlying commands stay registered for the seams + E2E but are hidden from the
  palette, and the split menu pairs collapse to one entry.
- Keybindings with `mac` variants (the missing variant is why ⌃⌥R "didn't work"
  on macOS — Option combos are unreliable there): `cmd+alt+e`/`ctrl+alt+e` for
  Ask-Claude-to-Edit, `cmd+alt+r`/`ctrl+alt+r` for the review panel.
- The instruction prompt now renders INLINE at the selection/cursor via a
  dedicated Comments-API controller (`InlineAskController`, `cowriting.askClaude`)
  instead of the top-center QuickInput — VS Code's Inline-Chat-style placement.
  Both Ask-Claude entry points (editSelection + the preview's askClaude) share it.

Tests: routeEdit unit tests; E2E menu/palette assertions updated for the unified
command; E2E drives the inline prompt by stubbing `api.inlineAsk.prompt`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
BenStullsBets
2026-06-26 05:00:35 -07:00
parent a42e5f145d
commit d6b3c6fa5f
9 changed files with 285 additions and 80 deletions
+53 -15
View File
@@ -59,6 +59,21 @@
"title": "Apply Agent Edit (internal seam)",
"category": "Cowriting"
},
{
"command": "cowriting.edit",
"title": "Ask Claude to Edit",
"category": "Cowriting"
},
{
"command": "cowriting.askClaude.submit",
"title": "Ask Claude to Edit",
"category": "Cowriting"
},
{
"command": "cowriting.askClaude.cancel",
"title": "Cancel",
"category": "Cowriting"
},
{
"command": "cowriting.editSelection",
"title": "Ask Claude to Edit Selection",
@@ -118,14 +133,30 @@
"command": "cowriting.rejectProposal",
"when": "false"
},
{
"command": "cowriting.askClaude.submit",
"when": "false"
},
{
"command": "cowriting.askClaude.cancel",
"when": "false"
},
{
"command": "cowriting.pinDiffBaseline",
"when": "editorLangId == markdown"
},
{
"command": "cowriting.editDocument",
"command": "cowriting.edit",
"when": "editorLangId == markdown"
},
{
"command": "cowriting.editSelection",
"when": "false"
},
{
"command": "cowriting.editDocument",
"when": "false"
},
{
"command": "cowriting.acceptAllProposals",
"when": "editorLangId == markdown"
@@ -140,13 +171,8 @@
],
"editor/title/context": [
{
"command": "cowriting.editSelection",
"when": "editorHasSelection && resourceLangId == markdown",
"group": "1_cowriting@1"
},
{
"command": "cowriting.editDocument",
"when": "!editorHasSelection && resourceLangId == markdown",
"command": "cowriting.edit",
"when": "resourceLangId == markdown",
"group": "1_cowriting@1"
},
{
@@ -164,13 +190,8 @@
],
"editor/context": [
{
"command": "cowriting.editSelection",
"when": "editorHasSelection && editorLangId == markdown && (resourceScheme == file || resourceScheme == untitled)",
"group": "1_cowriting@1"
},
{
"command": "cowriting.editDocument",
"when": "!editorHasSelection && editorLangId == markdown && (resourceScheme == file || resourceScheme == untitled)",
"command": "cowriting.edit",
"when": "editorLangId == markdown && (resourceScheme == file || resourceScheme == untitled)",
"group": "1_cowriting@1"
},
{
@@ -184,6 +205,11 @@
"command": "cowriting.reply",
"group": "inline",
"when": "commentController == cowriting.threads"
},
{
"command": "cowriting.askClaude.submit",
"group": "inline",
"when": "commentController == cowriting.askClaude"
}
],
"comments/commentThread/title": [
@@ -196,6 +222,11 @@
"command": "cowriting.reopenThread",
"group": "inline",
"when": "commentController == cowriting.threads && commentThread =~ /^resolved$/"
},
{
"command": "cowriting.askClaude.cancel",
"group": "inline",
"when": "commentController == cowriting.askClaude"
}
]
},
@@ -203,7 +234,14 @@
{
"command": "cowriting.showTrackChangesPreview",
"key": "ctrl+alt+r",
"mac": "cmd+alt+r",
"when": "editorLangId == markdown"
},
{
"command": "cowriting.edit",
"key": "ctrl+alt+e",
"mac": "cmd+alt+e",
"when": "editorTextFocus && editorLangId == markdown"
}
]
},