Skip "open this directory" menu entry in case of errors (#37872)

Follow-up of https://github.com/zed-industries/zed/pull/37564

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov
2025-09-09 19:53:03 +00:00
committed by GitHub
parent 18c6d9d394
commit eb7154d099
2 changed files with 8 additions and 4 deletions
+5 -4
View File
@@ -392,10 +392,11 @@ impl PickerDelegate for OpenPathDelegate {
let should_prepend_with_current_dir = this
.read_with(cx, |picker, _| {
!input_is_empty
&& !matches!(
picker.delegate.directory_state,
DirectoryState::Create { .. }
)
&& match &picker.delegate.directory_state {
DirectoryState::List { error, .. } => error.is_none(),
DirectoryState::Create { .. } => false,
DirectoryState::None { .. } => false,
}
})
.unwrap_or(false);
if should_prepend_with_current_dir {
@@ -39,6 +39,9 @@ async fn test_open_path_prompt(cx: &mut TestAppContext) {
let (picker, cx) = build_open_path_prompt(project, false, PathStyle::current(), cx);
insert_query(path!("sadjaoislkdjasldj"), &picker, cx).await;
assert_eq!(collect_match_candidates(&picker, cx), Vec::<String>::new());
let query = path!("/root");
insert_query(query, &picker, cx).await;
assert_eq!(collect_match_candidates(&picker, cx), vec!["root"]);