diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 93feb4a71d18164501955b46187a14d6757d861e..b873a58d3b61338b25c5908c2f87b62acb95d6f6 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -853,10 +853,13 @@ fn handle_open_request(request: OpenRequest, app_state: Arc, cx: &mut // languages.$(language).tab_size // [ languages $(language) tab_size] workspace::with_active_or_new_workspace(cx, |_workspace, window, cx| { - window.dispatch_action( - Box::new(zed_actions::OpenSettingsAt { path: setting_path }), - cx, - ); + match setting_path { + None => window.dispatch_action(Box::new(zed_actions::OpenSettings), cx), + Some(setting_path) => window.dispatch_action( + Box::new(zed_actions::OpenSettingsAt { path: setting_path }), + cx, + ), + } }); } } diff --git a/crates/zed/src/zed/open_listener.rs b/crates/zed/src/zed/open_listener.rs index 618849b3474e60f8a3737facf7c502f6e5f1cf52..3a4d19592e6bf543c9a0257d602656e6af3afcae 100644 --- a/crates/zed/src/zed/open_listener.rs +++ b/crates/zed/src/zed/open_listener.rs @@ -47,7 +47,10 @@ pub enum OpenRequestKind { AgentPanel, DockMenuAction { index: usize }, BuiltinJsonSchema { schema_path: String }, - Setting { setting_path: String }, + Setting { + // None just opens settings without navigating to a specific path + setting_path: Option , + }, } impl OpenRequest { @@ -94,9 +97,14 @@ impl OpenRequest { this.kind = Some(OpenRequestKind::BuiltinJsonSchema { schema_path: schema_path.to_string(), }); - } else if let Some(setting_path) = url.strip_prefix("zed://settings/") { + } else if url == "zed://settings" || url == "zed://settings/" { this.kind = Some(OpenRequestKind::Setting { - setting_path: setting_path.to_string(), + setting_path: None + }); + } + else if let Some(setting_path) = url.strip_prefix("zed://settings/") { + this.kind = Some(OpenRequestKind::Setting { + setting_path: Some(setting_path.to_string()), }); } else if url.starts_with("ssh://") { this.parse_ssh_file_path(&url, cx)?