Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix buffer restoration on ssh projects (#20215)

Conrad Irwin17b9d1976fd4
diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rs
index cde1b33d369..f309b2657d3 100644
--- a/crates/editor/src/items.rs
+++ b/crates/editor/src/items.rs
@@ -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);
})?;