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.

extension_cli: Copy over snippet file when bundling extensions (#34450)

Piotr Osiewicz52f2b3255781
diff --git a/crates/extension_cli/src/main.rs b/crates/extension_cli/src/main.rs
index 45a7e3b6412..ab4a9cddb0f 100644
--- a/crates/extension_cli/src/main.rs
+++ b/crates/extension_cli/src/main.rs
@@ -289,6 +289,24 @@ async fn copy_extension_resources(
}
}
+ if let Some(snippets_path) = manifest.snippets.as_ref() {
+ let parent = snippets_path.parent();
+ if let Some(parent) = parent.filter(|p| p.components().next().is_some()) {
+ fs::create_dir_all(output_dir.join(parent))?;
+ }
+ copy_recursive(
+ fs.as_ref(),
+ &extension_path.join(&snippets_path),
+ &output_dir.join(&snippets_path),
+ CopyOptions {
+ overwrite: true,
+ ignore_if_exists: false,
+ },
+ )
+ .await
+ .with_context(|| format!("failed to copy snippets from '{}'", snippets_path.display()))?;
+ }
+
Ok(())
}