Only allow opening one Extensions view (#9569)
Release Notes: - Changed the extensions view to only allow one open instance at a time. ## Before <img width="494" alt="image" src="https://github.com/zed-industries/zed/assets/5518/9329e685-1946-4384-bec3-f7eadf18a0cc">
This commit is contained in:
parent
3853991c20
commit
0ce5cdc48f
1 changed files with 12 additions and 2 deletions
|
@ -29,8 +29,18 @@ pub fn init(cx: &mut AppContext) {
|
|||
cx.observe_new_views(move |workspace: &mut Workspace, cx| {
|
||||
workspace
|
||||
.register_action(move |workspace, _: &Extensions, cx| {
|
||||
let extensions_page = ExtensionsPage::new(workspace, cx);
|
||||
workspace.add_item_to_active_pane(Box::new(extensions_page), cx)
|
||||
let existing = workspace
|
||||
.active_pane()
|
||||
.read(cx)
|
||||
.items()
|
||||
.find_map(|item| item.downcast::<ExtensionsPage>());
|
||||
|
||||
if let Some(existing) = existing {
|
||||
workspace.activate_item(&existing, cx);
|
||||
} else {
|
||||
let extensions_page = ExtensionsPage::new(workspace, cx);
|
||||
workspace.add_item_to_active_pane(Box::new(extensions_page), cx)
|
||||
}
|
||||
})
|
||||
.register_action(move |_, _: &InstallDevExtension, cx| {
|
||||
let store = ExtensionStore::global(cx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue