Repository navigation
editor: T-112 spec, VS Code typing undo groups - #46
Merged
Merged
Conversation
Refs: T-112, ED-2, ED-4
UndoGrouping, Editor::set_undo_grouping, undo_grouping, set_time and TYPING_PAUSE, and Keymap::with_undo_grouping and undo_grouping, with todo!() bodies and the rules in Editor's type docs. Three new test files, 39 tests, each ignored until the implementation lands. Refs: T-112, ED-2, ED-4
shubhook
marked this pull request as ready for review
November 28, 2026 16:26
All seven keep the spec's choice, so the interface and tests stand. Refs: T-112, ED-2, ED-4
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.
Task: T-112, tasks/112-vscode-undo-groups.md
PRD: ED-2, ED-4
What changed
This is the spec PR for T-112: the task file, the interface as stubs, and the acceptance tests. Nothing is implemented. Written against main at
3566348.In VS Code mode, a run of typing will undo in one step. The editor decides where a step ends: a pause, a cursor move, a switch between typing and deleting, Enter, a deleted line break, a paste, undo and redo. Vim's groups don't change.
crates/helm-editor/src):UndoGrouping(Explicit, the default, andTyping),Editor::set_undo_grouping,undo_grouping,set_time(Duration)andTYPING_PAUSE(1 s), andKeymap::with_undo_groupingandundo_grouping. Methods havetodo!()bodies.UndoGroupingandTYPING_PAUSEare plain data and work now. The rules are in the "Typing groups (T-112)" section ofEditor's type docs. Updated doc comments say howdispatch,dispatch_in,vscode::keymap(),Clone for Editor,end_undo_groupandin_undo_groupwill change. Their code is unchanged in this PR.helm-uicallsEditor::set_timebefore each key.helm-editornever reads a clock. A timestamp field onKeyEventwould break struct literals in four protected test files andbenches/vim.rs.#[ignore = "T-112: not implemented yet"]. They aretyping_groups.rs(25),vscode_undo.rs(10) andtyping_group_properties.rs(4 proptest properties, 256 cases each). No existing test file changes.cargo test -p helm-editor --no-fail-fast -- --ignoredfails all 39.c53b211): the task file records them, quoted below. No stub, doc comment or test changed.Throwaway check
I checked the tests against a throwaway implementation that isn't in this PR:
helm-editortests, so no T-101 to T-114 test changes behaviour.dispatch_innot setting the grouping, and an other edit joining the typing step.For the council
This PR gets one council round, aimed at the tests: do they test what ED-2 and ED-4 ask for, and could a wrong implementation pass them? The property oracle reads three facts off a twin editor under
Explicitgrouping: whether an edit applied, whether a motion moved, and whether a delete lowered the line count. The task file says why properties 2 and 4 leave out lone CRs.VS Code's docs and Helm proposals
VS Code's public docs don't describe when typing splits into undo steps. They only list
undo,redo,cursorUndoand the paste action. So every boundary rule is a Helm proposal, and Khakha's answers below settle them for Helm. Where VS Code's MIT-licensed source agrees, the task file says so.Protected paths
tasks/112-vscode-undo-groups.mdis undertasks/**. Khakha added theapproved-protectedlabel, and the protected-paths check passes onc53b211. The new test files are new files, not edits to existing ones.Dependencies, unsafe, threading
No new dependency. No
unsafe. No threads. NoCargo.tomlorCargo.lockchange.Open questions for Khakha: answered
Khakha answered all seven and kept the spec's choice on each. So the interface and the tests stand as written, and the implementation can start. Khakha's answers, as written:
The questions as asked. Questions 1 to 4 blocked the implementation, and 5 to 7 had defaults:
ab, Left,c.helm-uicallingset_undo_groupingafter each switch.TYPING_PAUSEas a constant, or a field onUndoGrouping::Typingfor ST-1 (answered: a constant).Commands run
On
1a54b47.c53b211changes onlytasks/112-vscode-undo-groups.md, and CI passed on it.This PR adds no benchmark and changes no code path that a benchmark runs: the stubs aren't called from existing code. So no speed number is claimed. The implementation PR adds the three
typing/benchmarks that the task file lists.CI benchmarks
All numbers are bench-compare's fastest of three medians, not means, against base
3566348.On
c53b211(run 46165336874), every benchmark is within the gate: "No benchmark regressed past its budget." Changes range from −6.90% (amend/type_100_chars_undo_10mb) to +1.86% (vim/visual_w_d_undo_1000_cursors_10mb).vim_objects/di_paren_no_pair_10mbmeasured 1.076 ms on base and 1.075 ms on head, −0.06%.On
1a54b47(run 46161217339), the first attempt failed the gate on one benchmark:vim_objects/di_paren_no_pair_10mb, 899.19 µs on base and 1.070 ms on head, +19.03%. Every other benchmark was within ±3.4%, apart fromencoding/decode_encode_bom_10mb, which was 6.55% faster. I ran a controlled comparison before treating the 19% as noise:x86_64-unknown-linux-gnu, all 427 functions inhelm-editorat base have the same instructions at head,find_pairand the rest of the bracket scan included. I compared the emitted assembly with symbol hashes, label numbers and constant names normalized. Head only adds the five stub functions.vim_objectsbenchmark binaries (local), every function sits at the same address. The only instruction differences are 59addimmediates, each 3 bytes higher in head, where read-only data moved. They are in 28Editorandvimmethods. None of them isfind_pairor the code under it, the bracket scan the benchmark times.bench-shard (cursor vim_objects).di_paren_no_pair_10mbmeasured 893.75 µs on base and 916.62 µs on head, +2.56%, and bench-compare reported "No benchmark regressed past its budget."Outside sources
main, read to understand its behaviour only, with no code copied:src/vs/editor/common/cursorCommon.ts,cursor/cursor.ts,cursor/cursorTypeOperations.ts,cursor/cursorDeleteOperations.ts, and part ofcursor/cursorTypeEditOperations.ts.Agent and model
Claude Code, model Claude Opus 5.5 (
claude-opus-5-5). Neither changed during the thread.