From 4d72db8bc9d6a40a8b0d7dcbd558ef5416265eb3 Mon Sep 17 00:00:00 2001
From: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com>
Date: Thu, 16 Jul 2026 12:30:16 +0200
Subject: [PATCH] file_finder: Add include_ignored parameter to Toggle action
(#59568)
# Objective
Allow keybindings to open the file finder with ignored files
pre-included, regardless of the global `file_finder.include_ignored`
setting:
```json
{
"bindings": {
"ctrl-shift-o": ["file_finder::Toggle", { "include_ignored": true }]
}
}
```
Closes https://github.com/zed-industries/zed/discussions/42575
## Solution
- Describe the solution used to achieve the objective above.
## Testing
- Did you test these changes? If so, how?
manually locally and a unit test.
- Are there any parts that need more testing?
no
- How can other people (reviewers) test your changes? Is there anything
specific they need to know?
no
- If relevant, what platforms did you test these changes on, and are
there any important ones you can't test?
macOS
## Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
## Showcase
> This section is optional. If this PR does not include a visual change
or does not add a new user-facing feature, you can delete this section.
- Help others understand the result of this PR by showcasing your
awesome work!
- If this PR includes a visual change, consider adding a screenshot,
GIF, or video
- A before/after comparison is very useful for changes to existing
features!
While a showcase should aim to be brief and digestible, you can use a
toggleable section to save space on longer showcases:
Click to view showcase
My super cool demos here
---
Release Notes:
- Added `include_ignored` parameter to `file_finder::Toggle` action,
allowing keybindings to open the file finder with ignored files
pre-included.
---------
Co-authored-by: Smit Barmase
---
crates/file_finder/src/file_finder.rs | 14 ++++++-
crates/file_finder/src/file_finder_tests.rs | 43 +++++++++++++++++++++
crates/workspace/src/workspace.rs | 2 +
3 files changed, 57 insertions(+), 2 deletions(-)
diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rs
index daf7b938e4..a9bdd7288d 100644
--- a/crates/file_finder/src/file_finder.rs
+++ b/crates/file_finder/src/file_finder.rs
@@ -87,7 +87,14 @@ impl FileFinder {
workspace.register_action(
|workspace, action: &workspace::ToggleFileFinder, window, cx| {
let Some(file_finder) = workspace.active_modal::(cx) else {
- Self::open(workspace, action.separate_history, window, cx).detach();
+ Self::open(
+ workspace,
+ action.separate_history,
+ action.include_ignored,
+ window,
+ cx,
+ )
+ .detach();
return;
};
@@ -104,6 +111,7 @@ impl FileFinder {
fn open(
workspace: &mut Workspace,
separate_history: bool,
+ include_ignored: Option,
window: &mut Window,
cx: &mut Context,
) -> Task<()> {
@@ -156,6 +164,7 @@ impl FileFinder {
currently_opened_path,
history_items.collect(),
separate_history,
+ include_ignored,
window,
cx,
);
@@ -953,6 +962,7 @@ impl FileFinderDelegate {
currently_opened_path: Option,
history_items: Vec,
separate_history: bool,
+ include_ignored: Option,
window: &mut Window,
cx: &mut Context,
) -> Self {
@@ -982,7 +992,7 @@ impl FileFinderDelegate {
separate_history,
first_update: true,
focus_handle: cx.focus_handle(),
- include_ignored: FileFinderSettings::get_global(cx).include_ignored,
+ include_ignored: include_ignored.or(FileFinderSettings::get_global(cx).include_ignored),
include_ignored_refresh: Task::ready(()),
}
}
diff --git a/crates/file_finder/src/file_finder_tests.rs b/crates/file_finder/src/file_finder_tests.rs
index e83d7db791..ec49c8a373 100644
--- a/crates/file_finder/src/file_finder_tests.rs
+++ b/crates/file_finder/src/file_finder_tests.rs
@@ -1094,6 +1094,48 @@ async fn test_ignored_root_with_file_inclusions_repro(cx: &mut TestAppContext) {
});
}
+#[gpui::test]
+async fn test_toggle_action_include_ignored_param(cx: &mut TestAppContext) {
+ let app_state = init_test(cx);
+ let project = Project::test(app_state.fs.clone(), [], cx).await;
+ let (multi_workspace, cx) =
+ cx.add_window_view(|window, cx| MultiWorkspace::test_new(project, window, cx));
+ let workspace = multi_workspace.read_with(cx, |mw, _| mw.workspace().clone());
+
+ let cases = [
+ (None, Some(true), Some(true)),
+ (None, Some(false), Some(false)),
+ (None, None, None),
+ (Some(true), Some(false), Some(false)),
+ (Some(false), Some(true), Some(true)),
+ (Some(true), None, Some(true)),
+ ];
+ for (setting, action_param, expected) in cases {
+ cx.update(|_, cx| {
+ let settings = *FileFinderSettings::get_global(cx);
+ FileFinderSettings::override_global(
+ FileFinderSettings {
+ include_ignored: setting,
+ ..settings
+ },
+ cx,
+ );
+ });
+ cx.dispatch_action(ToggleFileFinder {
+ separate_history: false,
+ include_ignored: action_param,
+ });
+ let picker = active_file_picker(&workspace, cx);
+ picker.update(cx, |picker, _| {
+ assert_eq!(
+ picker.delegate.include_ignored, expected,
+ "setting: {setting:?}, action param: {action_param:?}"
+ );
+ });
+ cx.dispatch_action(menu::Cancel);
+ }
+}
+
#[gpui::test]
async fn test_ignored_root(cx: &mut TestAppContext) {
let app_state = init_test(cx);
@@ -4513,6 +4555,7 @@ pub(crate) fn open_file_picker(
) -> Entity> {
cx.dispatch_action(ToggleFileFinder {
separate_history: true,
+ include_ignored: None,
});
active_file_picker(workspace, cx)
}
diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs
index b93e8a64bf..e91019f6ca 100644
--- a/crates/workspace/src/workspace.rs
+++ b/crates/workspace/src/workspace.rs
@@ -481,6 +481,8 @@ actions!(
pub struct ToggleFileFinder {
#[serde(default)]
pub separate_history: bool,
+ #[serde(default)]
+ pub include_ignored: Option,
}
/// Opens a new terminal in the center.