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_host: Add error context to add_extension_to_index (#45913)

Aru Sahni778609f6862c
diff --git a/crates/extension_host/src/extension_host.rs b/crates/extension_host/src/extension_host.rs
index 09e82597716..1f907f514d5 100644
--- a/crates/extension_host/src/extension_host.rs
+++ b/crates/extension_host/src/extension_host.rs
@@ -1534,12 +1534,14 @@ impl ExtensionStore {
let is_dev = fs
.metadata(&extension_dir)
.await?
- .context("directory does not exist")?
+ .with_context(|| format!("missing extension directory {extension_dir:?}"))?
.is_symlink;
- if let Ok(mut language_paths) = fs.read_dir(&extension_dir.join("languages")).await {
+ let language_dir = extension_dir.join("languages");
+ if let Ok(mut language_paths) = fs.read_dir(&language_dir).await {
while let Some(language_path) = language_paths.next().await {
- let language_path = language_path?;
+ let language_path = language_path
+ .with_context(|| format!("reading entries in language dir {language_dir:?}"))?;
let Ok(relative_path) = language_path.strip_prefix(&extension_dir) else {
continue;
};
@@ -1549,7 +1551,10 @@ impl ExtensionStore {
if !fs_metadata.is_dir {
continue;
}
- let config = fs.load(&language_path.join("config.toml")).await?;
+ let language_config_path = language_path.join("config.toml");
+ let config = fs.load(&language_config_path).await.with_context(|| {
+ format!("loading language config from {language_config_path:?}")
+ })?;
let config = ::toml::from_str::<LanguageConfig>(&config)?;
let relative_path = relative_path.to_path_buf();