diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rs index cde1b33d369519da2f420b4f46df28d658a469cc..f309b2657d3f0a7f8eeb3173b31415f2e88a4a48 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); })?;