Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Add debugging info when a symbol is not found (#15330)
Antonio Scandurra64add2f22281
diff --git a/crates/assistant/src/context.rs b/crates/assistant/src/context.rsindex 445eec8fe5b..0fa5a894d6e 100644--- a/crates/assistant/src/context.rs+++ b/crates/assistant/src/context.rs@@ -532,7 +532,21 @@ impl EditOperation {.path_candidates.iter().find(|item| item.string == symbol)- .context("symbol not found")?;+ .with_context(|| {+ format!(+ "symbol {:?} not found in path {:?}.\ncandidates: {:?}.\nparse status: {:?}. text:\n{}",+ symbol,+ path,+ outline+ .path_candidates+ .iter()+ .map(|candidate| &candidate.string)+ .collect::<Vec<_>>(),+ *parse_status.borrow(),+ buffer.read_with(&cx, |buffer, _| buffer.text()).unwrap_or_else(|_| "error".to_string())+ )+ })?;+buffer.update(&mut cx, |buffer, _| {let outline_item = &outline.items[candidate.id];let symbol_range = outline_item.range.to_point(buffer);