Add zed://extension/{id} links (#34492)

Release Notes:

- Add zed://extension/{id} links to open the extensions UI with a
specific extension
This commit is contained in:
Conrad Irwin 2025-07-15 13:42:25 -06:00 committed by GitHub
parent ec52e9281a
commit 3751737621
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 72 additions and 10 deletions

View file

@ -746,6 +746,23 @@ fn handle_open_request(request: OpenRequest, app_state: Arc<AppState>, cx: &mut
return;
}
if let Some(extension) = request.extension_id {
cx.spawn(async move |cx| {
let workspace = workspace::get_any_active_workspace(app_state, cx.clone()).await?;
workspace.update(cx, |_, window, cx| {
window.dispatch_action(
Box::new(zed_actions::Extensions {
category_filter: None,
id: Some(extension),
}),
cx,
);
})
})
.detach_and_log_err(cx);
return;
}
if let Some(connection_options) = request.ssh_connection {
cx.spawn(async move |mut cx| {
let paths: Vec<PathBuf> = request.open_paths.into_iter().map(PathBuf::from).collect();

View file

@ -37,6 +37,7 @@ pub struct OpenRequest {
pub join_channel: Option<u64>,
pub ssh_connection: Option<SshConnectionOptions>,
pub dock_menu_action: Option<usize>,
pub extension_id: Option<String>,
}
impl OpenRequest {
@ -54,6 +55,8 @@ impl OpenRequest {
} else if let Some(file) = url.strip_prefix("zed://ssh") {
let ssh_url = "ssh:/".to_string() + file;
this.parse_ssh_file_path(&ssh_url, cx)?
} else if let Some(file) = url.strip_prefix("zed://extension/") {
this.extension_id = Some(file.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) {