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.

Add more context (#60913)

Kirill Bulatov7cf50a771f54
diff --git a/crates/agent_ui/src/mention_set.rs b/crates/agent_ui/src/mention_set.rs
index 506c68cc080..78579c80462 100644
--- a/crates/agent_ui/src/mention_set.rs
+++ b/crates/agent_ui/src/mention_set.rs
@@ -263,7 +263,7 @@ impl MentionSet {
.read(cx)
.project_path_for_absolute_path(&abs_path, cx)
else {
- log::error!("project path not found");
+ log::error!("project path not found for image mention {abs_path:?}");
return Task::ready(());
};
let image_task = project.update(cx, |project, cx| project.open_image(project_path, cx));
@@ -395,7 +395,9 @@ impl MentionSet {
.read(cx)
.project_path_for_absolute_path(&abs_path, cx)
else {
- return Task::ready(Err(anyhow!("project path not found")));
+ return Task::ready(Err(anyhow!(
+ "project path not found for file mention {abs_path:?}"
+ )));
};
if is_raster_image_path(&abs_path) {
@@ -465,7 +467,9 @@ impl MentionSet {
.read(cx)
.project_path_for_absolute_path(&abs_path, cx)
else {
- return Task::ready(Err(anyhow!("project path not found")));
+ return Task::ready(Err(anyhow!(
+ "project path not found for symbol mention {abs_path:?}"
+ )));
};
let buffer = project.update(cx, |project, cx| project.open_buffer(project_path, cx));
cx.spawn(async move |_, cx| {
@@ -1222,7 +1226,9 @@ fn full_mention_for_directory(
.read(cx)
.project_path_for_absolute_path(&abs_path, cx)
else {
- return Task::ready(Err(anyhow!("project path not found")));
+ return Task::ready(Err(anyhow!(
+ "project path not found for directory mention {abs_path:?}"
+ )));
};
let Some(entry) = project.read(cx).entry_for_path(&project_path, cx) else {
return Task::ready(Err(anyhow!("project entry not found")));
diff --git a/crates/agent_ui/src/message_editor.rs b/crates/agent_ui/src/message_editor.rs
index f9878d6c5ad..e80c8274599 100644
--- a/crates/agent_ui/src/message_editor.rs
+++ b/crates/agent_ui/src/message_editor.rs
@@ -1164,7 +1164,11 @@ impl MessageEditor {
.update(cx, |project, cx| {
project.project_path_for_absolute_path(&file_path, cx)
})
- .ok_or_else(|| "project path not found".to_string())?;
+ .ok_or_else(|| {
+ format!(
+ "project path not found for pasted selection {file_path:?}"
+ )
+ })?;
let buffer = project
.update(cx, |project, cx| project.open_buffer(project_path, cx))
diff --git a/crates/debugger_ui/src/session/running/stack_frame_list.rs b/crates/debugger_ui/src/session/running/stack_frame_list.rs
index ea8192ebb80..738a44df7d0 100644
--- a/crates/debugger_ui/src/session/running/stack_frame_list.rs
+++ b/crates/debugger_ui/src/session/running/stack_frame_list.rs
@@ -395,7 +395,10 @@ impl StackFrameList {
let stack_frame_id = stack_frame.id;
self.opened_stack_frame_id = Some(stack_frame_id);
let Some(abs_path) = Self::abs_path_from_stack_frame(&stack_frame) else {
- return Task::ready(Err(anyhow!("Project path not found")));
+ return Task::ready(Err(anyhow!(
+ "no absolute source path in stack frame {stack_frame_id}, source: {:?}",
+ stack_frame.source
+ )));
};
let row = stack_frame.line.saturating_sub(1) as u32;
cx.emit(StackFrameListEvent::SelectedStackFrameChanged(
diff --git a/crates/editor/src/edit_prediction.rs b/crates/editor/src/edit_prediction.rs
index 5d110eb3ce1..dd57f5cb1d6 100644
--- a/crates/editor/src/edit_prediction.rs
+++ b/crates/editor/src/edit_prediction.rs
@@ -1660,13 +1660,16 @@ impl Editor {
) -> Task<Result<()>> {
workspace.update(cx, |workspace, cx| {
let path = snapshot.file().map(|file| file.full_path(cx));
- let Some(path) =
- path.and_then(|path| workspace.project().read(cx).find_project_path(path, cx))
+ let Some(project_path) = path
+ .as_ref()
+ .and_then(|path| workspace.project().read(cx).find_project_path(path, cx))
else {
- return Task::ready(Err(anyhow::anyhow!("Project path not found")));
+ return Task::ready(Err(anyhow::anyhow!(
+ "project path not found for edit prediction target {path:?}"
+ )));
};
let target = text::ToPoint::to_point(&target, snapshot);
- let item = workspace.open_path(path, None, true, window, cx);
+ let item = workspace.open_path(project_path, None, true, window, cx);
window.spawn(cx, async move |cx| {
let Some(editor) = item.await?.downcast::<Editor>() else {
return Ok(());