Feature Request
Add Lens.transaction() for atomic batch edits that commit or rollback together.
Use Case
When making multi-line changes, if the connection drops mid-edit, the file can be left in a partial state. Transactions would ensure all-or-nothing.
Proposed API
// Option 1: Callback style
Lens.transaction(() => {
Lens.setLine(10, 'new code');
Lens.insertLine(11, 'more code');
Lens.deleteLine(20);
}); // All changes applied atomically
// Option 2: Explicit commit
const tx = Lens.begin();
tx.setLine(10, 'new code');
tx.insertLine(11, 'more code');
tx.commit(); // or tx.rollback()
Implementation Notes
- Buffer changes in memory
- Apply all at once on commit
- Track original content for rollback
- Could integrate with undo/redo stack
Priority
Medium - workaround exists (careful single edits), but would improve reliability for complex refactors.
Feature Request
Add
Lens.transaction()for atomic batch edits that commit or rollback together.Use Case
When making multi-line changes, if the connection drops mid-edit, the file can be left in a partial state. Transactions would ensure all-or-nothing.
Proposed API
Implementation Notes
Priority
Medium - workaround exists (careful single edits), but would improve reliability for complex refactors.