Fix empty code actions menu trapping cursor (#33386)
Closes: https://github.com/zed-industries/zed/issues/33382 Follow-up to: https://github.com/zed-industries/zed/pull/32579 CC: @ConradIrwin @Anthony-Eid Release Notes: - Fixed an issue with empty code actions menu locking the cursor (Preview Only)
This commit is contained in:
parent
7d087ea5d2
commit
93d670af13
2 changed files with 15 additions and 7 deletions
|
@ -1205,7 +1205,7 @@ impl CodeActionContents {
|
|||
tasks_len + code_actions_len + self.debug_scenarios.len()
|
||||
}
|
||||
|
||||
fn is_empty(&self) -> bool {
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.len() == 0
|
||||
}
|
||||
|
||||
|
|
|
@ -5976,15 +5976,23 @@ impl Editor {
|
|||
|
||||
editor.update_in(cx, |editor, window, cx| {
|
||||
crate::hover_popover::hide_hover(editor, cx);
|
||||
let actions = CodeActionContents::new(
|
||||
resolved_tasks,
|
||||
code_actions,
|
||||
debug_scenarios,
|
||||
task_context.unwrap_or_default(),
|
||||
);
|
||||
|
||||
// Don't show the menu if there are no actions available
|
||||
if actions.is_empty() {
|
||||
cx.notify();
|
||||
return Task::ready(Ok(()));
|
||||
}
|
||||
|
||||
*editor.context_menu.borrow_mut() =
|
||||
Some(CodeContextMenu::CodeActions(CodeActionsMenu {
|
||||
buffer,
|
||||
actions: CodeActionContents::new(
|
||||
resolved_tasks,
|
||||
code_actions,
|
||||
debug_scenarios,
|
||||
task_context.unwrap_or_default(),
|
||||
),
|
||||
actions,
|
||||
selected_item: Default::default(),
|
||||
scroll_handle: UniformListScrollHandle::default(),
|
||||
deployed_from,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue