settings_ui: Add ability to copy a link for a given setting (#41172)
Release Notes: - settings_ui: Added the ability to copy a link to a given setting, allowing users to quickly open the settings window at the correct location in a faster way. --------- Co-authored-by: cameron <cameron.studdstreet@gmail.com> Co-authored-by: Ben Kunkle <ben@zed.dev>
This commit is contained in:
co-authored by
cameron
Ben Kunkle
parent
3583e129d1
commit
16c399876c
@@ -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,
|
||||
),
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,11 +43,20 @@ pub struct OpenRequest {
|
||||
#[derive(Debug)]
|
||||
pub enum OpenRequestKind {
|
||||
CliConnection((mpsc::Receiver<CliRequest>, IpcSender<CliResponse>)),
|
||||
Extension { extension_id: String },
|
||||
Extension {
|
||||
extension_id: String,
|
||||
},
|
||||
AgentPanel,
|
||||
DockMenuAction { index: usize },
|
||||
BuiltinJsonSchema { schema_path: String },
|
||||
Setting { setting_path: String },
|
||||
DockMenuAction {
|
||||
index: usize,
|
||||
},
|
||||
BuiltinJsonSchema {
|
||||
schema_path: String,
|
||||
},
|
||||
Setting {
|
||||
// None just opens settings without navigating to a specific path
|
||||
setting_path: Option<String>,
|
||||
},
|
||||
}
|
||||
|
||||
impl OpenRequest {
|
||||
@@ -94,9 +103,11 @@ impl OpenRequest {
|
||||
this.kind = Some(OpenRequestKind::BuiltinJsonSchema {
|
||||
schema_path: schema_path.to_string(),
|
||||
});
|
||||
} else if url == "zed://settings" || url == "zed://settings/" {
|
||||
this.kind = Some(OpenRequestKind::Setting { setting_path: None });
|
||||
} else if let Some(setting_path) = url.strip_prefix("zed://settings/") {
|
||||
this.kind = Some(OpenRequestKind::Setting {
|
||||
setting_path: setting_path.to_string(),
|
||||
setting_path: Some(setting_path.to_string()),
|
||||
});
|
||||
} else if url.starts_with("ssh://") {
|
||||
this.parse_ssh_file_path(&url, cx)?
|
||||
|
||||
Reference in New Issue
Block a user