file_finder: Remove common segments of long paths in search results (#25049)

This PR makes progress on #7711 by identifying any common prefix of the
paths in the file finder's search results, and replacing the "interior"
of that prefix---every path segment but the first and last---with `...`,
when a heuristic indicates that the longest path would otherwise
overflow the modal.

The elision is not applied to any segment that contains a match for the
search query.

There may be more work to do on #7711 in the case of long result paths
that do not share a significant common prefix.

Release Notes:

- Improved display of long paths in the file finder modal

Co-authored-by: Max <max@zed.dev>
This commit is contained in:
Cole Miller 2025-02-18 10:09:15 -05:00 committed by GitHub
parent 80458ffb96
commit 9ef0501853
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
49 changed files with 207 additions and 157 deletions

View file

@ -843,7 +843,6 @@ impl Pane {
}
}
#[allow(clippy::too_many_arguments)]
pub(crate) fn open_item(
&mut self,
project_entry_id: Option<ProjectEntryId>,

View file

@ -122,7 +122,6 @@ impl PaneGroup {
};
}
#[allow(clippy::too_many_arguments)]
pub fn render(
&self,
project: &Entity<Project>,
@ -228,7 +227,6 @@ impl Member {
}
}
#[allow(clippy::too_many_arguments)]
pub fn render(
&self,
project: &Entity<Project>,
@ -678,7 +676,6 @@ impl PaneAxis {
None
}
#[allow(clippy::too_many_arguments)]
fn render(
&self,
project: &Entity<Project>,
@ -882,7 +879,6 @@ mod element {
self
}
#[allow(clippy::too_many_arguments)]
fn compute_resize(
flexes: &Arc<Mutex<Vec<f32>>>,
e: &MouseMoveEvent,
@ -972,7 +968,6 @@ mod element {
window.refresh();
}
#[allow(clippy::too_many_arguments)]
fn layout_handle(
axis: Axis,
pane_bounds: Bounds<Pixels>,

View file

@ -2696,7 +2696,6 @@ impl Workspace {
)
}
#[allow(clippy::too_many_arguments)]
pub fn add_item(
&mut self,
pane: Entity<Pane>,