Expand description
Shared edit engine: byte-offset conversion, content replacement, syntax validation, and auto-backup orchestration.
Used by write, edit_symbol, edit_match, and batch commands.
Structs§
- DryRun
Result - Result of a dry-run diff computation.
- Write
Result - Result of the write → format → validate pipeline.
Functions§
- auto_
backup - Snapshot the file into the backup store before mutation.
- compute_
diff_ info - Compute diff info between before/after content for UI metadata. Returns a JSON value with before, after, additions, deletions. For files >512KB, omits full content and returns only counts.
- dry_
run_ diff - Compute a unified diff between original and proposed content, plus syntax validation.
- is_
dry_ run - Extract the
dry_runboolean from request params. - line_
col_ to_ byte - Convert 0-indexed line/col to a byte offset within
source. - replace_
byte_ range - Replace bytes in
[start..end)withreplacement. - validate_
syntax - Validate syntax of a file using a fresh FileParser (D023).
- validate_
syntax_ str - Validate syntax of an in-memory string without touching disk.
- wants_
diff - Check if the caller requested diff info in the response.
- write_
format_ only - Format an already-written file (no re-write) without re-writing or validating. Returns Ok(true) if formatting was applied, Ok(false) if skipped.
- write_
format_ validate - Write content to disk, auto-format, then validate syntax.