Change summary
crates/zed/src/main.rs | 11 +++++++----
crates/zed/src/zed/open_listener.rs | 14 +++++++++++---
2 files changed, 18 insertions(+), 7 deletions(-)
Detailed changes
@@ -853,10 +853,13 @@ fn handle_open_request(request: OpenRequest, app_state: Arc<AppState>, 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,
+ ),
+ }
});
}
}
@@ -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<String> ,
+ },
}
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)?