Skip to content

Commit

Permalink
Fix buffer restoration on ssh projects (#20215)
Browse files Browse the repository at this point in the history
Closes #20143

Release Notes:

- Remoting: Fixed a panic restoring unsaved untitled buffers over SSH
  • Loading branch information
ConradIrwin authored Nov 5, 2024
1 parent 3856599 commit 17b9d19
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions crates/editor/src/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -992,12 +992,15 @@ impl SerializableItem for Editor {
};

// First create the empty buffer
let buffer = project.update(&mut cx, |project, cx| {
project.create_local_buffer("", language, cx)
})?;
let buffer = project
.update(&mut cx, |project, cx| project.create_buffer(cx))?
.await?;

// Then set the text so that the dirty bit is set correctly
buffer.update(&mut cx, |buffer, cx| {
if let Some(language) = language {
buffer.set_language(Some(language), cx);
}
buffer.set_text(contents, cx);
})?;

Expand Down

0 comments on commit 17b9d19

Please sign in to comment.