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.

assistant2: Add intermediate bindings to improve conditional readability (#22790)

Marshall Bowersc53615ff6104
diff --git a/crates/assistant2/src/context_picker/directory_context_picker.rs b/crates/assistant2/src/context_picker/directory_context_picker.rs
index 29d07c2e694..11fc9bee0b8 100644
--- a/crates/assistant2/src/context_picker/directory_context_picker.rs
+++ b/crates/assistant2/src/context_picker/directory_context_picker.rs
@@ -188,7 +188,7 @@ impl PickerDelegate for DirectoryContextPickerDelegate {
};
let path = mat.path.clone();
- if self
+ let already_included = self
.context_store
.update(cx, |context_store, _cx| {
if let Some(context_id) = context_store.included_directory(&path) {
@@ -198,8 +198,8 @@ impl PickerDelegate for DirectoryContextPickerDelegate {
false
}
})
- .unwrap_or(true)
- {
+ .unwrap_or(true);
+ if already_included {
return;
}
diff --git a/crates/assistant2/src/context_picker/file_context_picker.rs b/crates/assistant2/src/context_picker/file_context_picker.rs
index 5e132468d0a..1318b03cce0 100644
--- a/crates/assistant2/src/context_picker/file_context_picker.rs
+++ b/crates/assistant2/src/context_picker/file_context_picker.rs
@@ -202,7 +202,7 @@ impl PickerDelegate for FileContextPickerDelegate {
};
let path = mat.path.clone();
- if self
+ let already_included = self
.context_store
.update(cx, |context_store, _cx| {
match context_store.included_file(&path) {
@@ -214,8 +214,8 @@ impl PickerDelegate for FileContextPickerDelegate {
None => false,
}
})
- .unwrap_or(true)
- {
+ .unwrap_or(true);
+ if already_included {
return;
}