From 3409a84f3d23b0ffb372c89067cdde74ef4f90ef Mon Sep 17 00:00:00 2001 From: Oleksiy Syvokon Date: Thu, 23 Apr 2026 16:00:32 +0300 Subject: [PATCH] Show progress indicator in file finder (#54515) When opening the file finder in a large project, it was impossible to tell whether the scan was complete and if the results were final. Now we show an animated arrow circle while the scan is active. Screenshot 2026-04-22 at 18 42 01 Closes #48009 Release Notes: - N/A --------- Co-authored-by: Danilo Leal --- Cargo.lock | 1 + crates/file_finder/Cargo.toml | 1 + crates/file_finder/src/file_finder.rs | 44 ++++++++++++++++++++++++--- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4ed668f605d..14f14dad109 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6306,6 +6306,7 @@ dependencies = [ "theme", "theme_settings", "ui", + "ui_input", "util", "workspace", "zed_actions", diff --git a/crates/file_finder/Cargo.toml b/crates/file_finder/Cargo.toml index 67ebab62295..f7f09956c15 100644 --- a/crates/file_finder/Cargo.toml +++ b/crates/file_finder/Cargo.toml @@ -31,6 +31,7 @@ settings.workspace = true serde.workspace = true theme.workspace = true ui.workspace = true +ui_input.workspace = true util.workspace = true workspace.workspace = true zed_actions.workspace = true diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rs index 9a9cc983fa7..d75481f6f74 100644 --- a/crates/file_finder/src/file_finder.rs +++ b/crates/file_finder/src/file_finder.rs @@ -13,8 +13,8 @@ use fuzzy::{StringMatch, StringMatchCandidate}; use fuzzy_nucleo::{PathMatch, PathMatchCandidate}; use gpui::{ Action, AnyElement, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, - KeyContext, Modifiers, ModifiersChangedEvent, ParentElement, Render, Styled, Task, WeakEntity, - Window, actions, rems, + KeyContext, Modifiers, ModifiersChangedEvent, ParentElement, Render, + StatefulInteractiveElement, Styled, Task, WeakEntity, Window, actions, rems, }; use open_path_prompt::{ OpenPathPrompt, @@ -37,9 +37,10 @@ use std::{ }, }; use ui::{ - ButtonLike, ContextMenu, HighlightedLabel, Indicator, KeyBinding, ListItem, ListItemSpacing, - PopoverMenu, PopoverMenuHandle, TintColor, Tooltip, prelude::*, + ButtonLike, CommonAnimationExt, ContextMenu, HighlightedLabel, Indicator, KeyBinding, ListItem, + ListItemSpacing, PopoverMenu, PopoverMenuHandle, TintColor, Tooltip, prelude::*, }; +use ui_input::ErasedEditor; use util::{ ResultExt, maybe, paths::{PathStyle, PathWithPosition}, @@ -1757,6 +1758,41 @@ impl PickerDelegate for FileFinderDelegate { ) } + fn render_editor( + &self, + editor: &Arc, + window: &mut Window, + cx: &mut Context>, + ) -> Div { + let has_search_query = self.latest_search_query.is_some(); + let is_project_scan_running = { + let worktree_store = self.project.read(cx).worktree_store(); + !worktree_store.read(cx).initial_scan_completed() + }; + + h_flex() + .flex_none() + .h_9() + .px_2p5() + .justify_between() + .border_b_1() + .border_color(cx.theme().colors().border_variant) + .child(editor.render(window, cx)) + .when(is_project_scan_running && has_search_query, |this| { + this.child( + h_flex() + .id("project-scan-indicator") + .tooltip(Tooltip::text("Project Scan in Progress…")) + .child( + Icon::new(IconName::LoadCircle) + .color(Color::Accent) + .size(IconSize::Small) + .with_rotate_animation(2), + ), + ) + }) + } + fn render_footer(&self, _: &mut Window, cx: &mut Context>) -> Option { let focus_handle = self.focus_handle.clone();