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: Restrict directory context picker to development builds (#22302)

Marshall Bowers7913b6a5a298
diff --git a/Cargo.lock b/Cargo.lock
index b1046eea4b7..67ea3f42fe5 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -493,6 +493,7 @@ dependencies = [
"project",
"proto",
"rand 0.8.5",
+ "release_channel",
"rope",
"schemars",
"serde",
diff --git a/crates/assistant2/Cargo.toml b/crates/assistant2/Cargo.toml
index c67674b4378..59d2b567f35 100644
--- a/crates/assistant2/Cargo.toml
+++ b/crates/assistant2/Cargo.toml
@@ -50,6 +50,7 @@ parking_lot.workspace = true
picker.workspace = true
project.workspace = true
proto.workspace = true
+release_channel.workspace = true
rope.workspace = true
schemars.workspace = true
serde.workspace = true
diff --git a/crates/assistant2/src/context_picker.rs b/crates/assistant2/src/context_picker.rs
index bf24daab3f0..5b590ac47ac 100644
--- a/crates/assistant2/src/context_picker.rs
+++ b/crates/assistant2/src/context_picker.rs
@@ -10,6 +10,7 @@ use gpui::{
WeakModel, WeakView,
};
use picker::{Picker, PickerDelegate};
+use release_channel::ReleaseChannel;
use ui::{prelude::*, ListItem, ListItemSpacing};
use util::ResultExt;
use workspace::Workspace;
@@ -50,23 +51,27 @@ impl ContextPicker {
confirm_behavior: ConfirmBehavior,
cx: &mut ViewContext<Self>,
) -> Self {
- let mut entries = vec![
- ContextPickerEntry {
- name: "File".into(),
- kind: ContextKind::File,
- icon: IconName::File,
- },
- ContextPickerEntry {
+ let mut entries = Vec::new();
+ entries.push(ContextPickerEntry {
+ name: "File".into(),
+ kind: ContextKind::File,
+ icon: IconName::File,
+ });
+ let release_channel = ReleaseChannel::global(cx);
+ // The directory context picker isn't fully implemented yet, so limit it
+ // to development builds.
+ if release_channel == ReleaseChannel::Dev {
+ entries.push(ContextPickerEntry {
name: "Folder".into(),
kind: ContextKind::Directory,
icon: IconName::Folder,
- },
- ContextPickerEntry {
- name: "Fetch".into(),
- kind: ContextKind::FetchedUrl,
- icon: IconName::Globe,
- },
- ];
+ });
+ }
+ entries.push(ContextPickerEntry {
+ name: "Fetch".into(),
+ kind: ContextKind::FetchedUrl,
+ icon: IconName::Globe,
+ });
if thread_store.is_some() {
entries.push(ContextPickerEntry {