Rework LSP tool keyboard story (#33525)

https://github.com/user-attachments/assets/81da68fe-bbc5-4b23-8182-923c752a8bd2

* Removes all extra elements: headers, buttons, to simplify the menu
navigation approach and save space.
Implements the keyboard navigation and panel toggling.

* Keeps the status icon and the server name, and their ordering approach
(current buffer/other) in the menu.
The status icon can still be hovered, but that is not yet possible to
trigger from the keyboard: future ideas would be make a similar side
display instead of hover, as Zeta menu does:


![image](https://github.com/user-attachments/assets/c844bc39-00ed-4fe3-96d5-1c9d323a21cc)

* Allows to start (if all are stopped) and stop (if some are not
stopped) all servers at once now with the button at the bottom

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov 2025-06-27 16:25:56 +03:00 committed by GitHub
parent 2178f66af6
commit 865dd4c5fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 286 additions and 253 deletions

View file

@ -30,7 +30,7 @@ use gpui::{
px, retain_all,
};
use image_viewer::ImageInfo;
use language_tools::lsp_tool::LspTool;
use language_tools::lsp_tool::{self, LspTool};
use migrate::{MigrationBanner, MigrationEvent, MigrationNotification, MigrationType};
use migrator::{migrate_keymap, migrate_settings};
pub use open_listener::*;
@ -294,20 +294,18 @@ pub fn initialize_workspace(
show_software_emulation_warning_if_needed(specs, window, cx);
}
let popover_menu_handle = PopoverMenuHandle::default();
let inline_completion_menu_handle = PopoverMenuHandle::default();
let edit_prediction_button = cx.new(|cx| {
inline_completion_button::InlineCompletionButton::new(
app_state.fs.clone(),
app_state.user_store.clone(),
popover_menu_handle.clone(),
inline_completion_menu_handle.clone(),
cx,
)
});
workspace.register_action({
move |_, _: &inline_completion_button::ToggleMenu, window, cx| {
popover_menu_handle.toggle(window, cx);
inline_completion_menu_handle.toggle(window, cx);
}
});
@ -326,7 +324,15 @@ pub fn initialize_workspace(
cx.new(|cx| toolchain_selector::ActiveToolchain::new(workspace, window, cx));
let vim_mode_indicator = cx.new(|cx| vim::ModeIndicator::new(window, cx));
let image_info = cx.new(|_cx| ImageInfo::new(workspace));
let lsp_tool = cx.new(|cx| LspTool::new(workspace, window, cx));
let lsp_tool_menu_handle = PopoverMenuHandle::default();
let lsp_tool =
cx.new(|cx| LspTool::new(workspace, lsp_tool_menu_handle.clone(), window, cx));
workspace.register_action({
move |_, _: &lsp_tool::ToggleMenu, window, cx| {
lsp_tool_menu_handle.toggle(window, cx);
}
});
let cursor_position =
cx.new(|_| go_to_line::cursor_position::CursorPosition::new(workspace));