Repository navigation
feat(paste): arbitrate clipboard text, HTML and images as one paste - #486
Merged
Merged
Conversation
…etadata Split table/URL/list/rich paste into pure decisions returning a replacement range plus render, and add the immutable pending-operation StateField (mapping, conflict cancellation, history/reseed cancel, delegated-paste supersession). Not yet wired into production.
Verify registration before any I/O, settle File slots in clipboard order, compose one replacement, and dispatch the filtered transaction once; filter vetoes, deadlines and dispose terminate the operation without inserting.
Extract File transport behind a temporary legacy adapter, capture every obtainable File candidate, and route table/URL/list/rich decisions through the coordinator with live URL-syntax revalidation.
Rich code-context fallback, caption-on-rejection and pre/post-commit failure handling: an empty composed replacement terminates the operation without deleting the selection, and an adopted insertion is never retried.
Remove the legacy pending-anchor paths, guard settlement against a read-only flip, and surface insertion failures in the notice slot.
Serve a fresh production webview bundle to the browser suite and pin table/File, reply order, captions, undo, selection, CRLF, read-only and plain paste against it.
…nt of metadata cleanup Bind and log the causes of the bare catches in the coordinator and the image transport, run clearMetadata through a non-throwing helper so onUnlinkedPath/onFailure always fire, ignore a reader load after cancel, and pin the lost-operation arm and cancel closure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Clipboard text, HTML and image files are now arbitrated as one paste operation. A paste that carries a caption, table or rich content together with files inserts the text and every accepted image link in a single undoable transaction, at the original target, in clipboard order.
Changes
src/webview/cm/paste/paste-operation.ts(new): a pure StateField holds pending-operation metadata (id, mapped target, cancelled). A per-editor coordinator owns file reads, reply slots, deadlines, notices and the final dispatch.src/webview/cm/paste/clipboard-paste.ts(new): one DOM paste entry snapshots the clipboard. It applies text decisions with table → URL → list → rich → plain precedence, then registers the operation before any I/O.{from, to, render}decisions instead of dispatching themselves. Image paste feeds the coordinator.Related TODO
PASTE-03 PR1. Explicit plain paste (Cmd/Ctrl+Shift+V routing) is deferred to PASTE-03 PR2. Post-commit sync visibility is tracked as SYNC-01.
Test plan
pnpm compilepnpm test:unit: 289 files, 6164 testspnpm test:browser: 17 files, 92 testspnpm lintpnpm packageand the vsix audit, plus a local install🤖 Generated with Claude Code
https://claude.ai/code/session_01XMxzpbtpRHCeu7iKdR8Yc9