diff --git a/assets/settings/default.json b/assets/settings/default.json index 41efb43dfdc661..60a29c029fbf1e 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -1088,7 +1088,7 @@ // Whether to automatically open the agent panel when Zed launches. // // Default: false - "auto_open_panel": false + "auto_open_panel": false, }, // Whether the screen sharing icon is shown in the os status bar. "show_call_status_icon": true, @@ -2412,6 +2412,9 @@ "ssh_connections": [], // Whether to read ~/.ssh/config for ssh connection sources. "read_ssh_config": true, + // Whether to show a notification suggesting to open the project in a dev container + // when a `.devcontainer` directory is detected. + "suggest_dev_container": true, // Default timeout in seconds for all context server tool calls. // Individual servers can override this in their configuration. // Examples: diff --git a/crates/recent_projects/src/dev_container_suggest.rs b/crates/recent_projects/src/dev_container_suggest.rs index 1e50080ea15fad..6f30e003bc763e 100644 --- a/crates/recent_projects/src/dev_container_suggest.rs +++ b/crates/recent_projects/src/dev_container_suggest.rs @@ -1,6 +1,7 @@ use db::kvp::KEY_VALUE_STORE; use gpui::{SharedString, Window}; use project::{Project, WorktreeId}; +use settings::Settings; use std::sync::LazyLock; use ui::prelude::*; use util::rel_path::RelPath; @@ -9,6 +10,8 @@ use workspace::notifications::NotificationId; use workspace::notifications::simple_message_notification::MessageNotification; use worktree::UpdatedEntriesSet; +use crate::RemoteSettings; + const DEV_CONTAINER_SUGGEST_KEY: &str = "dev_container_suggest_dismissed"; fn devcontainer_path() -> &'static RelPath { @@ -28,6 +31,11 @@ pub fn suggest_on_worktree_updated( window: &mut Window, cx: &mut Context, ) { + // Check if dev container suggestions are enabled + if !RemoteSettings::get_global(cx).suggest_dev_container { + return; + } + let devcontainer_updated = updated_entries .iter() .any(|(path, _, _)| path.as_ref() == devcontainer_path()); diff --git a/crates/recent_projects/src/remote_connections.rs b/crates/recent_projects/src/remote_connections.rs index 9d6199786cb6f2..467f10fab23b2e 100644 --- a/crates/recent_projects/src/remote_connections.rs +++ b/crates/recent_projects/src/remote_connections.rs @@ -32,6 +32,9 @@ pub struct RemoteSettings { pub wsl_connections: ExtendingVec, /// Whether to read ~/.ssh/config for ssh connection sources. pub read_ssh_config: bool, + /// Whether to show a notification suggesting to open the project in a dev container + /// when a `.devcontainer` directory is detected. + pub suggest_dev_container: bool, } impl RemoteSettings { @@ -119,6 +122,7 @@ impl Settings for RemoteSettings { ssh_connections: remote.ssh_connections.clone().unwrap_or_default().into(), wsl_connections: remote.wsl_connections.clone().unwrap_or_default().into(), read_ssh_config: remote.read_ssh_config.unwrap(), + suggest_dev_container: remote.suggest_dev_container.unwrap_or(true), } } } diff --git a/crates/settings_content/src/settings_content.rs b/crates/settings_content/src/settings_content.rs index 8644e44f84c8f1..f55372b83a51dd 100644 --- a/crates/settings_content/src/settings_content.rs +++ b/crates/settings_content/src/settings_content.rs @@ -1020,6 +1020,11 @@ pub struct RemoteSettingsContent { pub dev_container_connections: Option>, pub read_ssh_config: Option, pub use_podman: Option, + /// Whether to show a notification suggesting to open the project in a dev container + /// when a `.devcontainer` directory is detected. + /// + /// Default: true + pub suggest_dev_container: Option, } #[with_fallible_options]