From 17b9d1976fd443f8ed3689b2e00a0840d6c9c313 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Mon, 4 Nov 2024 23:05:52 -0700 Subject: [PATCH] Fix buffer restoration on ssh projects (#20215) Closes #20143 Release Notes: - Remoting: Fixed a panic restoring unsaved untitled buffers over SSH --- crates/editor/src/items.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rs index cde1b33d36951..f309b2657d3f0 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); })?;