Repository navigation
feat(editor): detect and resolve external file conflicts - #330
Merged
Merged
Conversation
fcoury
force-pushed
the
fcoury/external-file-conflicts
branch
from
August 23, 2026 17:48
8e22d6a to
9d8ac08
Compare
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.
Why
The save-time protection already prevents Red from silently overwriting files changed outside the editor, but users still discover conflicts only when they try to save. Clean buffers do not follow external changes, dirty buffers have no persistent conflict indicator, and agent writes can replace unsaved edits before persistence fails.
What changed
[CONFLICT]/[DELETED]statusline markers, buffer metadata, and plugin events.:diffdiskwith a safe-by-default conflict comparison, explicit:w!/:w! <file>overrides, and guidance for:e!or saving local changes elsewhere.How to Test
[CONFLICT]. Run:wand confirm both the external file contents and local buffer contents remain unchanged.:diffdiskand verify it displays both versions. Press Enter to accept the default Keep edits action and confirm nothing is overwritten; reopen the comparison and choose Overwrite, or run:w!, to explicitly replace the file and clear the conflict.[DELETED]remains visible without discarding the buffer. Save to a new path with:w <file>and confirm the deleted source is not recreated.cargo test --lib file_watch,cargo test --test editing forced_write, andcargo test --test editing disk_conflict_comparison_defaults_to_preserving_both_versionsto cover watching, explicit overwrite, and the safe-default comparison flow.Validated on the PR branch: 2,372 library tests and 483 editor/LSP integration tests pass; formatting and
cargo clippy --all-targets --all-features -- -D warningsare clean. The same change rebased locally onto currentmainalso passes 2,385 library tests and all 483 editor/LSP integration tests.