mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 03:14:56 +07:00
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. <img width="425" height="380" alt="Screenshot 2026-04-22 at 18 42 01" src="https://github.com/user-attachments/assets/6d772483-a6c8-406b-bbf8-db810df7ab68" /> Closes #48009 Release Notes: - N/A --------- Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
This commit is contained in:
parent
8b1520467b
commit
3409a84f3d
3 changed files with 42 additions and 4 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -6306,6 +6306,7 @@ dependencies = [
|
|||
"theme",
|
||||
"theme_settings",
|
||||
"ui",
|
||||
"ui_input",
|
||||
"util",
|
||||
"workspace",
|
||||
"zed_actions",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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<dyn ErasedEditor>,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Picker<Self>>,
|
||||
) -> 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<Picker<Self>>) -> Option<AnyElement> {
|
||||
let focus_handle = self.focus_handle.clone();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue