Ask Claude to Edit Document — whole-document edit from body (no selection) + tab right-click #42
Notifications
Due Date
No due date set.
Depends on
#43 Preview toolbar as the primary interaction surface — adaptive "Ask Claude…" + Pin baseline buttons
benstull/vscode-cowriting-plugin
Reference: benstull/vscode-cowriting-plugin#42
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
"Ask Claude to Edit" is reachable by right-click whether or not text is
selected, and from the editor tab: right-clicking the document body with no
selection offers a new "Ask Claude to Edit Document" (whole-document edit),
and right-clicking the editor tab offers "Ask Claude to Edit Selection"
when text is selected or "Ask Claude to Edit Document" when it isn't.
Problem / pain
Asking Claude to edit is currently only offered in the editor body and only
when text is selected (
cowriting.editSelection, "Ask Claude to EditSelection", gated on
editorHasSelection). Two natural gestures get nothing:on the whole document but there is no affordance for it (and no
whole-document edit command exists at all).
document" gesture — offers no "Ask Claude to Edit" entry, selection or not.
So a writer who wants a document-level edit, or who reaches for the tab, hits a
dead end.
Who feels it
Writers using the plugin to co-edit a document with Claude — especially anyone
who wants a whole-document pass rather than a selection-scoped one, and
tab-oriented / mouse-first users.
Desired outcome / value
A consistent "Ask Claude to Edit" entry point: selection-scoped when there's a
selection, whole-document when there isn't, available both in the body and on
the tab. Adds the missing whole-document edit capability and makes both
scopes discoverable from the obvious right-click gestures.
Acceptance — "done right"
Edit Document", which asks Claude to edit the entire document and surfaces
the result through the existing F4 propose/accept seam.
Claude to Edit Selection" (unchanged behavior).
the document has an active selection, otherwise "Ask Claude to Edit
Document", each invoking the same behavior as the body equivalents against
that document.
with the existing
editSelectionwhenclause (resourceScheme == file || untitled).machinery as selection edits (no separate, divergent edit path).
edit-selection item appears with a selection, both appear on the tab per
selection state, and each produces a proposal.
Scope / non-goals
cowriting.editDocument);editor/contextwiring for the no-selection case;editor/title/context(tab) wiring for both selection states; reuse of theexisting edit → propose/accept seam.
context-menu entry (tab + body only, per the ask); no new proposal-granularity
model — whole-doc edits use the existing F4 mechanics; no multi-file / batch
document editing.
Assumptions · constraints · dependencies
cowriting.editSelectionalready exists and routes edits through the F4propose/accept seam (whole-proposal granularity); a whole-document edit is the
same flow with the range spanning the entire document.
a whole-document edit (reuse the selection-edit prompt?); whether a full-document
rewrite surfaces as one large proposal or several; behavior/expectations on
large documents (token limits). These are why this is a feature, not a bare
story.
title; the tab menu shows oneof two commands chosen by a
whenclause on selection state (no per-menudynamic relabel of a single command).
on; sibling discoverability ask in this same capture session (review-panel
right-click entry).
Source / signal
Self-originated — capture session vscode-cowriting-plugin-0035 (operator ask:
"Add 'Ask Claude to Edit Document' in the context menu when right-clicking the
body with no text selected; the same Edit Selection / Edit Document should be in
the context menu when right-clicking the tab").
Priority (WSJF)
Value (med — adds whole-document editing + closes two dead-end gestures) ·
Time-criticality (low) · Opportunity-enablement (low–med, a new edit scope) ÷
Size (small) → modest-but-favorable score.
priority/P2.Decomposition
cowriting.editDocumentcommand — ask Claude to edit the whole document, routed through the existing edit → F4 propose/accept seam.editor/context(body) wiring: show Edit Document when!editorHasSelection, keep Edit Selection wheneditorHasSelection.editor/title/context(tab) wiring: show Edit Selection when there's a selection, else Edit Document, against the tab's document.Solution notes (optional — NOT a design)
The cleanest shape is a thin
editDocumentcommand that constructs afull-document range and calls the same edit entry point
editSelectionuses, soattribution and propose/accept are shared. The tab menu is two commands gated by
editorHasSelection(or the closest tab-context equivalent), not one command thatrelabels itself. Non-binding — the design step settles instruction-gathering and
proposal-granularity for whole-document edits.
Shipped as SLICE-1 of the document-edit flow (#49, session 0043). Selection-aware Ask Claude to Edit is now reachable from the editor body and the editor tab (selection → Edit Selection; no selection → Edit Document), markdown/authorable-gated, both through the single
runEditAndProposepath (INV-38). 208 unit + 65/5 host E2E green.