Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Show progress indicator in file finder (#54515)

Oleksiy Syvokon3409a84f3d23
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<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();