Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Begin work to dynamically add terminal names to menu
Joseph Lyonsc80942ea0024
diff --git a/crates/workspace/src/terminal_button.rs b/crates/workspace/src/terminal_button.rsindex 6573809359b..47891523276 100644--- a/crates/workspace/src/terminal_button.rs+++ b/crates/workspace/src/terminal_button.rs@@ -113,13 +113,23 @@ impl TerminalButton {_action: &DeployTerminalMenu,cx: &mut ViewContext<Self>,) {+ let mut menu_options = vec![ContextMenuItem::item("New Terminal", NewTerminal)];++ if let Some(workspace) = self.workspace.upgrade(cx) {+ let project = workspace.read(cx).project().read(cx);+ let local_terminal_handles = project.local_terminal_handles();++ for local_terminal_handle in local_terminal_handles {+ if let Some(_) = local_terminal_handle.upgrade(cx) {+ // TODO: Obtain the actual terminal "name" and put it in the menu+ // TODO: Replace the `NewTerminal` action with an action that instead focuses the selected terminal+ menu_options.push(ContextMenuItem::item("Terminal", NewTerminal))+ }+ }+ }+self.popup_menu.update(cx, |menu, cx| {- menu.show(- vec2f(0., 0.),- AnchorCorner::TopLeft,- vec![ContextMenuItem::item("New Terminal", NewTerminal)],- cx,- );+ menu.show(vec2f(0., 0.), AnchorCorner::TopLeft, menu_options, cx);});}}