Fix buffer restoration on ssh projects (#20215)

Closes #20143

Release Notes:

- Remoting: Fixed a panic restoring unsaved untitled buffers over SSH
This commit is contained in:
Conrad Irwin 2024-11-04 23:05:52 -07:00 committed by GitHub
parent 3856599853
commit 17b9d1976f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);
})?;