Add new action and handler for opening a specific setting (#40739)
Co-authored-by: Ben Kunkle <ben@zed.dev>
This commit is contained in:
co-authored by
Ben Kunkle
parent
c81ffaffb6
commit
98c7e018ae
@@ -847,6 +847,18 @@ fn handle_open_request(request: OpenRequest, app_state: Arc<AppState>, cx: &mut
|
||||
.detach();
|
||||
});
|
||||
}
|
||||
OpenRequestKind::Setting { setting_path } => {
|
||||
// zed://settings/languages/$(language)/tab_size - DONT SUPPORT
|
||||
// zed://settings/languages/Rust/tab_size - SUPPORT
|
||||
// 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,
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -47,6 +47,7 @@ pub enum OpenRequestKind {
|
||||
AgentPanel,
|
||||
DockMenuAction { index: usize },
|
||||
BuiltinJsonSchema { schema_path: String },
|
||||
Setting { setting_path: String },
|
||||
}
|
||||
|
||||
impl OpenRequest {
|
||||
@@ -93,6 +94,10 @@ impl OpenRequest {
|
||||
this.kind = Some(OpenRequestKind::BuiltinJsonSchema {
|
||||
schema_path: schema_path.to_string(),
|
||||
});
|
||||
} else if let Some(setting_path) = url.strip_prefix("zed://settings/") {
|
||||
this.kind = Some(OpenRequestKind::Setting {
|
||||
setting_path: setting_path.to_string(),
|
||||
});
|
||||
} else if url.starts_with("ssh://") {
|
||||
this.parse_ssh_file_path(&url, cx)?
|
||||
} else if let Some(request_path) = parse_zed_link(&url, cx) {
|
||||
|
||||
Reference in New Issue
Block a user