mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-15 08:23:37 +01:00
953f1f48b8
* NES: add exp config to yield additive cursor-line edit first for multi-line patches For diff-patch responses, the progressive ghost-text reveal emits the cursor-line edit ASAP when it additively changes the cursor line, but previously only for patches removing a single line. Extend it to fire for multi-removed-line first patches behind a new experiment config `chat.advanced.inlineEdits.xtabProvider.patchFastYieldLineWithCursorMultiLine` (default off): the additive cursor-line change (removed[0] -> added[0]) is yielded immediately and the remaining removed/added lines stream as a continuation. The early edit is a 1-for-1 additive replacement, so it causes no line shift and the continuation (anchored at cursorLine+1 over the original document) stays correctly anchored — the union is byte-identical to the original patch. Multi-line reveal is restricted to duplicate-additions modes that preserve a patch's removed range (Off / TrimDuplicate); DropPatch/DropAllRemaining could skip the continuation after the early edit was already emitted. The early reveal edit is additionally excluded from the duplicate-additions policy: it carries no re-emitted context to trim, and running the policy on it could spuriously trim its added line to empty and emit a cursor-line deletion when that line coincides with the line below the cursor (cascade edits). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Refactor NES multi-line reveal handler for readability Behavior-preserving cleanup of the diff-patch progressive-reveal logic in xtabPatchResponseHandler.ts. No functional change (75/75 spec tests pass unchanged). - Extract named policy helpers: duplicateModePreservesRemovedRange, allowsMultiLineProgressiveReveal, and shouldApplyDuplicatePolicy (a type guard that preserves the Exclude<..., Off> narrowing for applyDuplicatePolicy). - Add Patch.progressiveRevealParts() factory that owns the early/continuation split invariants; remove the misleading Patch.insertion helper (it built non-insertions for the multi-line case). - Split isGhostTextPatch into early returns plus a named isEmptyCursorLineShiftUp predicate for the empty-cursor-line shift-up guard. - Relocate long rationale comments into helper JSDoc so the streaming loop reads top-to-bottom. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>