Make LSP task cancellation discoverable (#13226)
Release Notes: - Added the ability to cancel a cargo check by clicking on the status bar item.
This commit is contained in:
parent
84a44bef8a
commit
89d2ace713
5 changed files with 144 additions and 30 deletions
|
@ -14,6 +14,7 @@ use theme::ThemeSettings;
|
|||
enum ContextMenuItem {
|
||||
Separator,
|
||||
Header(SharedString),
|
||||
Label(SharedString),
|
||||
Entry {
|
||||
toggled: Option<bool>,
|
||||
label: SharedString,
|
||||
|
@ -147,6 +148,12 @@ impl ContextMenu {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn label(mut self, label: impl Into<SharedString>) -> Self {
|
||||
let label = label.into();
|
||||
self.items.push(ContextMenuItem::Label(label));
|
||||
self
|
||||
}
|
||||
|
||||
pub fn action(mut self, label: impl Into<SharedString>, action: Box<dyn Action>) -> Self {
|
||||
self.items.push(ContextMenuItem::Entry {
|
||||
toggled: None,
|
||||
|
@ -284,6 +291,7 @@ impl ContextMenuItem {
|
|||
fn is_selectable(&self) -> bool {
|
||||
match self {
|
||||
ContextMenuItem::Separator => false,
|
||||
ContextMenuItem::Label { .. } => false,
|
||||
ContextMenuItem::Header(_) => false,
|
||||
ContextMenuItem::Entry { .. } => true,
|
||||
ContextMenuItem::CustomEntry { selectable, .. } => *selectable,
|
||||
|
@ -333,6 +341,11 @@ impl Render for ContextMenu {
|
|||
.inset(true)
|
||||
.into_any_element()
|
||||
}
|
||||
ContextMenuItem::Label(label) => ListItem::new(ix)
|
||||
.inset(true)
|
||||
.disabled(true)
|
||||
.child(Label::new(label.clone()))
|
||||
.into_any_element(),
|
||||
ContextMenuItem::Entry {
|
||||
toggled,
|
||||
label,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue