Fix settings file restored to both panes after restart#50842
Merged
Veykril merged 1 commit intozed-industries:mainfrom Mar 17, 2026
Merged
Fix settings file restored to both panes after restart#50842Veykril merged 1 commit intozed-industries:mainfrom
Veykril merged 1 commit intozed-industries:mainfrom
Conversation
Member
|
needs a rebase |
When deserializing a non-worktree file (e.g. settings.json), Editor::deserialize called workspace.open_abs_path() which had the side effect of adding the item to the default pane. The caller (deserialize_to) then also added the item to the target pane, resulting in the file appearing in two panes after restart. Replace open_abs_path() with project.open_local_buffer() to open the buffer without pane side effects, matching the in-worktree code path. Closes zed-industries#35947 Liam
02e4d05 to
3a6ed4b
Compare
Contributor
Author
|
@Veykril just rebased, let me know if there are any issues |
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.
Closes #35947
Summary
When a settings file was moved to a second pane and Zed restarted, the file appeared in both panes. Closing it in one pane would close it in the other.
Root cause
Editor::deserializerestored standalone files (like settings.json) by callingworkspace.open_abs_path(), which routes throughopen_path_preview→pane.open_item(), adding the editor to the workspace's default pane. The caller (SerializedPane::deserialize_to) then also adds the item to the target pane, so it ends up in two panes.This also caused the SQL constraint violations @MrSubidubi noted: the
itemstable hasPRIMARY KEY(item_id, workspace_id), so the duplicate triggers errors on the next serialisation cycle.Fix
Replace
workspace.open_abs_path()withproject.open_local_buffer(), which opens the buffer without touching any pane. Pane placement is left todeserialize_to.settings_dup_zed.mp4
Test plan
test_deserialize_non_worktree_file_does_not_add_to_pane)items::tests::test_deserializepasses (all 6 cases)cargo clippy -p editorcleanRelease Notes:
(#35947).