Do not fail hard on selection persistence if the editor is removed (#25120)
Follow-up of https://github.com/zed-industries/zed/pull/25083
Follows practices from editors' scroll position persisting:
5a05b7461e/crates/editor/src/persistence.rs (L200)
and do not fail hard if the editor with the ID given does not exist.
Also add the problematic IDs into the error context to see them in the
error logs.
Release Notes:
- N/A
This commit is contained in:
parent
98ea659af6
commit
92f128ebb0
2 changed files with 2 additions and 2 deletions
|
@ -2223,7 +2223,7 @@ impl Editor {
|
|||
.collect();
|
||||
DB.save_editor_selections(editor_id, workspace_id, selections)
|
||||
.await
|
||||
.context("persisting editor selections")
|
||||
.with_context(|| format!("persisting editor selections for editor {editor_id}, workspace {workspace_id:?}"))
|
||||
.log_err();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -247,7 +247,7 @@ impl EditorDb {
|
|||
r#"
|
||||
DELETE FROM editor_selections WHERE editor_id = ?1 AND workspace_id = ?2;
|
||||
|
||||
INSERT INTO editor_selections (editor_id, workspace_id, start, end)
|
||||
INSERT OR IGNORE INTO editor_selections (editor_id, workspace_id, start, end)
|
||||
VALUES {placeholders};
|
||||
"#
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue