iced_code_editor/canvas_editor/features/context_menu.rs
1//! Right-click context menu for editor actions.
2
3use iced::widget::{Space, button, column, container, row, text};
4use iced::{Background, Border, Color, Element, Length, Shadow, Theme, Vector};
5
6use super::actions::{ActionContext, SharedAction};
7use crate::canvas_editor::Message;
8use crate::i18n::Translations;
9
10const MENU_WIDTH: f32 = 224.0;
11
12/// An actionable entry in the editor context menu.
13///
14/// The `id` is what the host receives when the item is selected, so it should
15/// be a stable identifier rather than the display text — renaming or
16/// translating a `label` then never breaks the action.
17///
18/// # Examples
19///
20/// ```
21/// use iced_code_editor::ContextMenuItem;
22///
23/// let item = ContextMenuItem::new("format", "Format Document")
24/// .with_shortcut("Ctrl+Shift+F");
25///
26/// assert_eq!(item.id, "format");
27/// assert_eq!(item.shortcut.as_deref(), Some("Ctrl+Shift+F"));
28/// assert!(item.enabled);
29/// ```
30#[derive(Debug, Clone, PartialEq, Eq)]
31pub struct ContextMenuItem {
32 /// Stable action identifier emitted when the item is selected.
33 pub id: String,
34 /// Text displayed for the item.
35 pub label: String,
36 /// Optional keyboard shortcut hint displayed beside the label.
37 pub shortcut: Option<String>,
38 /// Whether the item can be selected.
39 pub enabled: bool,
40 /// Current state of a toggle command, `None` for every other command.
41 ///
42 /// Only the command palette reads it, where it is drawn as an On/Off badge
43 /// beside the label; the context menu ignores it. Set it on an entry that
44 /// switches a setting the host owns, and re-register the entries when that
45 /// setting changes so the badge stays truthful.
46 pub status: Option<bool>,
47}
48
49impl ContextMenuItem {
50 /// Creates an enabled context-menu item without a shortcut hint.
51 ///
52 /// # Arguments
53 ///
54 /// * `id` - Stable action identifier emitted when the item is selected
55 /// * `label` - The text shown to the user
56 ///
57 /// # Returns
58 ///
59 /// An enabled item with no shortcut hint
60 ///
61 /// # Examples
62 ///
63 /// ```
64 /// use iced_code_editor::ContextMenuItem;
65 ///
66 /// let item = ContextMenuItem::new("rename", "Rename Symbol");
67 /// assert_eq!(item.label, "Rename Symbol");
68 /// assert!(item.shortcut.is_none());
69 /// assert!(item.enabled);
70 /// ```
71 pub fn new(id: impl Into<String>, label: impl Into<String>) -> Self {
72 Self {
73 id: id.into(),
74 label: label.into(),
75 shortcut: None,
76 enabled: true,
77 status: None,
78 }
79 }
80
81 /// Sets the keyboard shortcut hint displayed beside this item.
82 ///
83 /// This is only a hint for the user: setting it does not bind the
84 /// shortcut, which the host application is responsible for handling.
85 ///
86 /// # Arguments
87 ///
88 /// * `shortcut` - The shortcut text to display, e.g. `Ctrl+Shift+F`
89 ///
90 /// # Returns
91 ///
92 /// Self for method chaining
93 ///
94 /// # Examples
95 ///
96 /// ```
97 /// use iced_code_editor::ContextMenuItem;
98 ///
99 /// let item = ContextMenuItem::new("format", "Format Document")
100 /// .with_shortcut("Ctrl+Shift+F");
101 /// assert_eq!(item.shortcut.as_deref(), Some("Ctrl+Shift+F"));
102 /// ```
103 #[must_use]
104 pub fn with_shortcut(mut self, shortcut: impl Into<String>) -> Self {
105 self.shortcut = Some(shortcut.into());
106 self
107 }
108
109 /// Sets whether this item can be selected.
110 ///
111 /// A disabled item is still drawn, dimmed — use this for an action that is
112 /// unavailable right now but should stay visible so the menu does not
113 /// change shape between right-clicks.
114 ///
115 /// # Arguments
116 ///
117 /// * `enabled` - Whether the item can be selected
118 ///
119 /// # Returns
120 ///
121 /// Self for method chaining
122 ///
123 /// # Examples
124 ///
125 /// ```
126 /// use iced_code_editor::ContextMenuItem;
127 ///
128 /// let item = ContextMenuItem::new("rename", "Rename Symbol")
129 /// .with_enabled(false);
130 /// assert!(!item.enabled);
131 /// ```
132 #[must_use]
133 pub fn with_enabled(mut self, enabled: bool) -> Self {
134 self.enabled = enabled;
135 self
136 }
137
138 /// Marks this item as a toggle currently in state `status`.
139 ///
140 /// The command palette then shows an On/Off badge beside the label, so the
141 /// user can tell what running the command will do without trying it. The
142 /// value is a snapshot: re-register the entries when the setting changes.
143 ///
144 /// # Arguments
145 ///
146 /// * `status` - Whether the setting the item toggles is currently on
147 ///
148 /// # Returns
149 ///
150 /// Self for method chaining
151 ///
152 /// # Examples
153 ///
154 /// ```
155 /// use iced_code_editor::ContextMenuItem;
156 ///
157 /// let item = ContextMenuItem::new("format_on_save", "Toggle Format On Save")
158 /// .with_status(true);
159 /// assert_eq!(item.status, Some(true));
160 /// ```
161 #[must_use]
162 pub fn with_status(mut self, status: bool) -> Self {
163 self.status = Some(status);
164 self
165 }
166}
167
168/// A custom editor context-menu entry.
169///
170/// Pass a list of these to [`CodeEditor::set_custom_context_menu_entries`] to
171/// extend the menu, or to replace it entirely by also turning off the built-in
172/// actions with [`CodeEditor::set_default_context_menu_enabled`].
173///
174/// # Examples
175///
176/// ```
177/// use iced_code_editor::ContextMenuEntry;
178///
179/// let entries = vec![
180/// ContextMenuEntry::item("format", "Format Document")
181/// .with_shortcut("Ctrl+Shift+F"),
182/// ContextMenuEntry::separator(),
183/// ContextMenuEntry::item("rename", "Rename Symbol").with_enabled(false),
184/// ];
185/// assert_eq!(entries.len(), 3);
186/// ```
187///
188/// [`CodeEditor::set_custom_context_menu_entries`]: crate::CodeEditor::set_custom_context_menu_entries
189/// [`CodeEditor::set_default_context_menu_enabled`]: crate::CodeEditor::set_default_context_menu_enabled
190#[derive(Debug, Clone, PartialEq, Eq)]
191pub enum ContextMenuEntry {
192 /// An actionable menu item.
193 Item(ContextMenuItem),
194 /// A visual separator between groups of items.
195 Separator,
196}
197
198impl ContextMenuEntry {
199 /// Creates an enabled action entry without a shortcut hint.
200 ///
201 /// Shorthand for wrapping [`ContextMenuItem::new`].
202 ///
203 /// # Arguments
204 ///
205 /// * `id` - Stable action identifier emitted when the entry is selected
206 /// * `label` - The text shown to the user
207 ///
208 /// # Returns
209 ///
210 /// An [`ContextMenuEntry::Item`] wrapping a new enabled item
211 ///
212 /// # Examples
213 ///
214 /// ```
215 /// use iced_code_editor::{ContextMenuEntry, ContextMenuItem};
216 ///
217 /// let entry = ContextMenuEntry::item("format", "Format Document");
218 /// assert_eq!(
219 /// entry,
220 /// ContextMenuEntry::Item(ContextMenuItem::new("format", "Format Document")),
221 /// );
222 /// ```
223 pub fn item(id: impl Into<String>, label: impl Into<String>) -> Self {
224 Self::Item(ContextMenuItem::new(id, label))
225 }
226
227 /// Creates a separator entry.
228 ///
229 /// # Returns
230 ///
231 /// A [`ContextMenuEntry::Separator`]
232 ///
233 /// # Examples
234 ///
235 /// ```
236 /// use iced_code_editor::ContextMenuEntry;
237 ///
238 /// assert_eq!(ContextMenuEntry::separator(), ContextMenuEntry::Separator);
239 /// ```
240 pub const fn separator() -> Self {
241 Self::Separator
242 }
243
244 /// Sets the keyboard shortcut hint when this is an action entry.
245 ///
246 /// A separator has no shortcut to set, so it is returned unchanged rather
247 /// than erroring — this keeps a chain of builder calls over a mixed list
248 /// of entries free of special cases.
249 ///
250 /// # Arguments
251 ///
252 /// * `shortcut` - The shortcut text to display, e.g. `Ctrl+Shift+F`
253 ///
254 /// # Returns
255 ///
256 /// Self for method chaining
257 ///
258 /// # Examples
259 ///
260 /// ```
261 /// use iced_code_editor::ContextMenuEntry;
262 ///
263 /// let entry = ContextMenuEntry::item("format", "Format Document")
264 /// .with_shortcut("Ctrl+Shift+F");
265 /// assert!(matches!(entry, ContextMenuEntry::Item(_)));
266 ///
267 /// // A separator is unaffected.
268 /// let separator = ContextMenuEntry::separator().with_shortcut("Ctrl+K");
269 /// assert_eq!(separator, ContextMenuEntry::Separator);
270 /// ```
271 #[must_use]
272 pub fn with_shortcut(self, shortcut: impl Into<String>) -> Self {
273 match self {
274 Self::Item(item) => Self::Item(item.with_shortcut(shortcut)),
275 Self::Separator => Self::Separator,
276 }
277 }
278
279 /// Sets whether this entry can be selected when it is an action.
280 ///
281 /// A separator is returned unchanged, for the same reason as
282 /// [`Self::with_shortcut`].
283 ///
284 /// # Arguments
285 ///
286 /// * `enabled` - Whether the entry can be selected
287 ///
288 /// # Returns
289 ///
290 /// Self for method chaining
291 ///
292 /// # Examples
293 ///
294 /// ```
295 /// use iced_code_editor::{ContextMenuEntry, ContextMenuItem};
296 ///
297 /// let entry = ContextMenuEntry::item("rename", "Rename Symbol")
298 /// .with_enabled(false);
299 /// assert_eq!(
300 /// entry,
301 /// ContextMenuEntry::Item(
302 /// ContextMenuItem::new("rename", "Rename Symbol").with_enabled(false)
303 /// ),
304 /// );
305 ///
306 /// // A separator is unaffected.
307 /// let separator = ContextMenuEntry::separator().with_enabled(false);
308 /// assert_eq!(separator, ContextMenuEntry::Separator);
309 /// ```
310 #[must_use]
311 pub fn with_enabled(self, enabled: bool) -> Self {
312 match self {
313 Self::Item(item) => Self::Item(item.with_enabled(enabled)),
314 Self::Separator => Self::Separator,
315 }
316 }
317}
318
319impl From<ContextMenuItem> for ContextMenuEntry {
320 fn from(item: ContextMenuItem) -> Self {
321 Self::Item(item)
322 }
323}
324
325#[derive(Debug, Clone)]
326enum MenuEntry {
327 Item { label: String, shortcut: String, message: Option<Message> },
328 Separator,
329}
330
331impl MenuEntry {
332 #[cfg(test)]
333 fn label(&self) -> Option<&str> {
334 match self {
335 Self::Item { label, .. } => Some(label),
336 Self::Separator => None,
337 }
338 }
339}
340
341fn custom_entries(entries: &[ContextMenuEntry]) -> Vec<MenuEntry> {
342 entries
343 .iter()
344 .map(|entry| match entry {
345 ContextMenuEntry::Item(item) => MenuEntry::Item {
346 label: item.label.clone(),
347 shortcut: item.shortcut.clone().unwrap_or_default(),
348 message: item
349 .enabled
350 .then(|| Message::CustomContextMenuAction(item.id.clone())),
351 },
352 ContextMenuEntry::Separator => MenuEntry::Separator,
353 })
354 .collect()
355}
356
357/// Builds the built-in half of the menu, in the order the menu shows it.
358///
359/// Every row's label, shortcut and message come from [`SharedAction`], which
360/// the command palette reads too; what belongs to the menu is the order, the
361/// separators, and the choice to *dim* an unavailable action rather than drop
362/// it. A menu with a fixed shape is what lets muscle memory work, so a row
363/// that cannot be run right now still holds its place.
364fn default_entries(
365 context: ActionContext,
366 translations: &Translations,
367) -> Vec<MenuEntry> {
368 /// Turns a shared action into a menu row, dimmed when unavailable.
369 fn row(
370 action: SharedAction,
371 context: ActionContext,
372 translations: &Translations,
373 ) -> MenuEntry {
374 MenuEntry::Item {
375 label: action.label(translations),
376 shortcut: action.shortcut().to_string(),
377 message: action.is_available(context).then(|| action.message()),
378 }
379 }
380
381 // Reveal sits above everything, separated: it acts on the file rather than
382 // on the text, and it is the only one the host can switch off entirely --
383 // so it is absent, not dimmed, when unavailable.
384 let mut entries = if SharedAction::RevealInFileManager.is_available(context)
385 {
386 vec![
387 row(SharedAction::RevealInFileManager, context, translations),
388 MenuEntry::Separator,
389 ]
390 } else {
391 Vec::new()
392 };
393
394 entries.extend([
395 row(SharedAction::Undo, context, translations),
396 row(SharedAction::Redo, context, translations),
397 MenuEntry::Separator,
398 row(SharedAction::Cut, context, translations),
399 row(SharedAction::Copy, context, translations),
400 row(SharedAction::Paste, context, translations),
401 MenuEntry::Separator,
402 row(SharedAction::SelectAll, context, translations),
403 ]);
404 entries
405}
406
407fn build_entries(
408 custom: &[ContextMenuEntry],
409 default_context_menu_enabled: bool,
410 context: ActionContext,
411 translations: &Translations,
412) -> Vec<MenuEntry> {
413 let mut entries = custom_entries(custom);
414 if default_context_menu_enabled {
415 if !entries.is_empty() {
416 entries.push(MenuEntry::Separator);
417 }
418 entries.extend(default_entries(context, translations));
419 }
420 entries
421}
422
423/// Builds the context-menu contents.
424pub(crate) fn view(
425 custom: &[ContextMenuEntry],
426 default_context_menu_enabled: bool,
427 context: ActionContext,
428 translations: Translations,
429) -> Element<'static, Message> {
430 let items = build_entries(
431 custom,
432 default_context_menu_enabled,
433 context,
434 &translations,
435 )
436 .into_iter()
437 .map(|entry| match entry {
438 MenuEntry::Item { label, shortcut, message } => {
439 menu_item(label, shortcut, message)
440 }
441 MenuEntry::Separator => separator(),
442 })
443 .collect::<Vec<_>>();
444
445 container(column(items).spacing(1).padding(4))
446 .width(Length::Fixed(MENU_WIDTH))
447 .style(|theme: &Theme| {
448 let palette = theme.extended_palette();
449 container::Style {
450 background: Some(Background::Color(
451 palette.background.weak.color,
452 )),
453 text_color: Some(palette.background.weak.text),
454 border: Border {
455 color: palette.background.strong.color,
456 width: 1.0,
457 radius: 6.0.into(),
458 },
459 shadow: Shadow {
460 color: Color::BLACK.scale_alpha(0.35),
461 offset: Vector::new(0.0, 4.0),
462 blur_radius: 14.0,
463 },
464 ..container::Style::default()
465 }
466 })
467 .into()
468}
469
470fn menu_item(
471 label: String,
472 shortcut: String,
473 message: Option<Message>,
474) -> Element<'static, Message> {
475 let enabled = message.is_some();
476 let content = row![
477 text(label).size(13),
478 Space::new().width(Length::Fill),
479 text(shortcut).size(12),
480 ]
481 .align_y(iced::Alignment::Center);
482
483 button(content)
484 .width(Length::Fill)
485 .padding([6, 9])
486 .on_press_maybe(message)
487 .style(move |theme: &Theme, status| {
488 let palette = theme.extended_palette();
489 let text_color = if enabled {
490 palette.background.weak.text
491 } else {
492 palette.background.weak.text.scale_alpha(0.35)
493 };
494 // A translucent accent keeps the menu surface visible while
495 // giving hover and press distinct, softer feedback in both themes.
496 let highlight_alpha = match status {
497 button::Status::Hovered => {
498 if palette.is_dark {
499 0.18
500 } else {
501 0.10
502 }
503 }
504 button::Status::Pressed => {
505 if palette.is_dark {
506 0.28
507 } else {
508 0.18
509 }
510 }
511 button::Status::Active | button::Status::Disabled => 0.0,
512 };
513 let background = (enabled && highlight_alpha > 0.0).then_some(
514 Background::Color(
515 palette.primary.base.color.scale_alpha(highlight_alpha),
516 ),
517 );
518
519 button::Style {
520 background,
521 text_color,
522 border: Border { radius: 6.0.into(), ..Border::default() },
523 ..button::Style::default()
524 }
525 })
526 .into()
527}
528
529fn separator() -> Element<'static, Message> {
530 let line =
531 container(Space::new().width(Length::Fill).height(Length::Fixed(1.0)))
532 .style(|theme: &Theme| {
533 let palette = theme.extended_palette();
534 container::Style {
535 background: Some(Background::Color(
536 palette.background.strong.color,
537 )),
538 ..container::Style::default()
539 }
540 });
541
542 container(line).padding([3, 7]).into()
543}
544
545#[cfg(test)]
546mod tests {
547 use super::*;
548 use crate::canvas_editor::CodeEditor;
549 use crate::canvas_editor::features::actions::SharedAction;
550 use crate::canvas_editor::features::command_palette::PaletteAction;
551 use crate::{ContextMenuEntry, ContextMenuItem, Language, Translations};
552
553 /// An editor in which every shared action is available, so both surfaces
554 /// offer all seven and the two lists can be compared row for row.
555 fn editor_with_everything_available() -> CodeEditor {
556 let mut editor = CodeEditor::new("hello", "rs");
557 editor.set_reveal_in_file_manager_enabled(true);
558 // Paste rather than type: typed characters stay in an open undo
559 // group, so nothing would be undoable yet. Two edits and one undo
560 // leaves both stacks non-empty at once, which is what makes Undo and
561 // Redo simultaneously available.
562 let _ = editor.update(&Message::Paste("a".to_string()));
563 let _ = editor.update(&Message::Paste("b".to_string()));
564 let _ = editor.update(&Message::Undo);
565 let _ = editor.update(&Message::SelectAll);
566
567 let context = editor.action_context();
568 assert!(context.can_undo && context.can_redo);
569 assert!(context.has_selection && context.has_content);
570 assert!(context.reveal_in_file_manager_enabled);
571
572 editor
573 }
574
575 // A missing row or a mismatched binding *is* the failure this test
576 // reports, so `panic!` is the report rather than a bug — the same reason
577 // the LSP protocol tests carry this allow.
578 #[test]
579 #[allow(clippy::panic)]
580 fn test_both_surfaces_render_every_shared_action_from_the_same_binding() {
581 // The drift this exists to prevent: the two surfaces used to spell out
582 // label / shortcut / message separately, so a relabelled action or a
583 // rebound key had to be edited in both, and nothing noticed when only
584 // one was. Reading them from `SharedAction` is what makes them equal;
585 // this walks all seven and checks that they really are.
586 let editor = editor_with_everything_available();
587 let translations = Translations::default();
588 let menu =
589 build_entries(&[], true, editor.action_context(), &translations);
590 let palette = editor.command_palette_entries();
591
592 for action in SharedAction::ALL {
593 let label = action.label(&translations);
594
595 let menu_row = menu
596 .iter()
597 .find_map(|entry| match entry {
598 MenuEntry::Item { label: found, shortcut, message }
599 if *found == label =>
600 {
601 Some((shortcut, message))
602 }
603 _ => None,
604 })
605 .unwrap_or_else(|| panic!("{label:?} missing from the menu"));
606
607 let palette_row = palette
608 .iter()
609 .find(|entry| entry.label == label)
610 .unwrap_or_else(|| {
611 panic!("{label:?} missing from the palette")
612 });
613
614 assert_eq!(
615 menu_row.0, &palette_row.shortcut,
616 "{label:?}: the two surfaces show different shortcut hints"
617 );
618 assert_eq!(
619 menu_row.0,
620 action.shortcut(),
621 "{label:?}: neither matches `SharedAction::shortcut`"
622 );
623
624 // `Message` is not `PartialEq`; its `Debug` form is enough to tell
625 // two variants -- and two `Paste` payloads -- apart.
626 let expected = format!("{:?}", action.message());
627 assert_eq!(
628 menu_row.1.as_ref().map(|message| format!("{message:?}")),
629 Some(expected.clone()),
630 "{label:?}: the menu sends a different message"
631 );
632 let sent = match &palette_row.action {
633 PaletteAction::Builtin(message) => format!("{message:?}"),
634 other => panic!("{label:?} is not a built-in row: {other:?}"),
635 };
636 assert_eq!(
637 sent, expected,
638 "{label:?}: the palette sends a different message"
639 );
640 }
641 }
642
643 #[test]
644 fn test_an_unavailable_action_is_dimmed_in_the_menu_but_absent_from_the_palette()
645 {
646 // The one thing the two surfaces are *meant* to disagree on. A fresh
647 // editor has nothing to undo, and no file behind it to reveal.
648 let editor = CodeEditor::new("hello", "rs");
649 let translations = Translations::default();
650 let undo = SharedAction::Undo.label(&translations);
651 let reveal = SharedAction::RevealInFileManager.label(&translations);
652
653 let menu =
654 build_entries(&[], true, editor.action_context(), &translations);
655 let palette = editor.command_palette_entries();
656
657 assert!(
658 menu.iter().any(|entry| matches!(
659 entry,
660 MenuEntry::Item { label, message: None, .. } if *label == undo
661 )),
662 "the menu keeps Undo in place, dimmed"
663 );
664 assert!(
665 !palette.iter().any(|entry| entry.label == undo),
666 "the palette drops Undo entirely"
667 );
668
669 // Reveal is the exception: the host switched it off, so it is absent
670 // from both rather than dimmed in one.
671 assert!(!menu.iter().any(|entry| entry.label() == Some(&reveal)));
672 assert!(!palette.iter().any(|entry| entry.label == reveal));
673 }
674
675 #[test]
676 fn test_custom_context_menu_action_message_preserves_id() {
677 let entries = build_entries(
678 &[ContextMenuEntry::Item(ContextMenuItem::new(
679 "refactor.extract",
680 "Extract function",
681 ))],
682 false,
683 ActionContext::default(),
684 &Translations::default(),
685 );
686
687 assert!(matches!(
688 &entries[0],
689 MenuEntry::Item {
690 message: Some(Message::CustomContextMenuAction(id)),
691 ..
692 }
693 if id == "refactor.extract"
694 ));
695 }
696
697 #[test]
698 fn test_custom_entries_precede_default_entries() {
699 let entries = build_entries(
700 &[ContextMenuEntry::item("custom.format", "Format document")],
701 true,
702 ActionContext::default(),
703 &Translations::default(),
704 );
705
706 assert_eq!(entries[0].label(), Some("Format document"));
707 assert!(matches!(entries[1], MenuEntry::Separator));
708 assert_eq!(entries[2].label(), Some("Undo"));
709 }
710
711 #[test]
712 fn test_context_menu_uses_selected_language() {
713 let translations = Translations::new(Language::ChineseSimplified);
714 let entries = default_entries(ActionContext::default(), &translations);
715
716 assert_eq!(entries[0].label(), Some("撤消"));
717 assert_eq!(entries[1].label(), Some("恢复"));
718 assert_eq!(entries[3].label(), Some("剪切"));
719 assert_eq!(entries[4].label(), Some("复制"));
720 assert_eq!(entries[5].label(), Some("粘贴"));
721 assert_eq!(entries[7].label(), Some("选择全部"));
722
723 let custom = custom_entries(&[ContextMenuEntry::item(
724 "custom.format",
725 "Format document",
726 )]);
727 assert_eq!(custom[0].label(), Some("Format document"));
728 }
729
730 #[test]
731 fn test_reveal_in_file_manager_entry_emits_request() {
732 let translations = Translations::new(Language::English);
733 let entries = build_entries(
734 &[],
735 true,
736 ActionContext {
737 reveal_in_file_manager_enabled: true,
738 ..ActionContext::default()
739 },
740 &translations,
741 );
742
743 assert!(matches!(
744 &entries[0],
745 MenuEntry::Item { label, shortcut, message }
746 if label == &translations.context_menu_reveal_in_file_manager()
747 && shortcut.is_empty()
748 && matches!(message, Some(Message::RevealInFileManager))
749 ));
750 assert!(matches!(entries[1], MenuEntry::Separator));
751 assert_eq!(entries[2].label(), Some("Undo"));
752 }
753
754 #[test]
755 fn test_reveal_in_file_manager_respects_default_menu_toggle() {
756 let entries = build_entries(
757 &[],
758 false,
759 ActionContext {
760 reveal_in_file_manager_enabled: true,
761 ..ActionContext::default()
762 },
763 &Translations::default(),
764 );
765
766 assert!(entries.is_empty());
767 }
768}