From 778609f6862cc4d0cbf3302f3f253792f47034da Mon Sep 17 00:00:00 2001 From: Aru Sahni Date: Mon, 5 Jan 2026 18:11:57 -0500 Subject: [PATCH] extension_host: Add error context to add_extension_to_index (#45913) Missing required extension files or directories currently result in opaque "Directory not found" errors being logged during the update index phase. This can be frustrating to those developing extensions. Add some context so folks know where to start looking. Release Notes: - N/A --------- Co-authored-by: Kirill Bulatov Co-authored-by: Kirill Bulatov --- crates/extension_host/src/extension_host.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/extension_host/src/extension_host.rs b/crates/extension_host/src/extension_host.rs index 09e8259771668346c237c1cc05e6074ca3b37797..1f907f514d5c1ea6f5783c620c25b6b1370a158e 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::(&config)?; let relative_path = relative_path.to_path_buf();