Show ignored entries in project panel

This commit is contained in:
Antonio Scandurra 2022-05-23 16:37:57 +02:00
parent fe1498dc1d
commit 1a6cc6f964
2 changed files with 10 additions and 3 deletions

View file

@ -59,6 +59,7 @@ struct EntryDetails {
filename: String, filename: String,
depth: usize, depth: usize,
kind: EntryKind, kind: EntryKind,
is_ignored: bool,
is_expanded: bool, is_expanded: bool,
is_selected: bool, is_selected: bool,
is_editing: bool, is_editing: bool,
@ -613,7 +614,7 @@ impl ProjectPanel {
} }
let mut visible_worktree_entries = Vec::new(); let mut visible_worktree_entries = Vec::new();
let mut entry_iter = snapshot.entries(false); let mut entry_iter = snapshot.entries(true);
while let Some(entry) = entry_iter.entry() { while let Some(entry) = entry_iter.entry() {
visible_worktree_entries.push(entry.clone()); visible_worktree_entries.push(entry.clone());
if Some(entry.id) == new_entry_parent_id { if Some(entry.id) == new_entry_parent_id {
@ -739,6 +740,7 @@ impl ProjectPanel {
.to_string(), .to_string(),
depth: entry.path.components().count(), depth: entry.path.components().count(),
kind: entry.kind, kind: entry.kind,
is_ignored: entry.is_ignored,
is_expanded: expanded_entry_ids.binary_search(&entry.id).is_ok(), is_expanded: expanded_entry_ids.binary_search(&entry.id).is_ok(),
is_selected: self.selection.map_or(false, |e| { is_selected: self.selection.map_or(false, |e| {
e.worktree_id == snapshot.id() && e.entry_id == entry.id e.worktree_id == snapshot.id() && e.entry_id == entry.id
@ -784,7 +786,12 @@ impl ProjectPanel {
let show_editor = details.is_editing && !details.is_processing; let show_editor = details.is_editing && !details.is_processing;
MouseEventHandler::new::<Self, _, _>(entry_id.to_usize(), cx, |state, _| { MouseEventHandler::new::<Self, _, _>(entry_id.to_usize(), cx, |state, _| {
let padding = theme.container.padding.left + details.depth as f32 * theme.indent_width; let padding = theme.container.padding.left + details.depth as f32 * theme.indent_width;
let style = theme.entry.style_for(state, details.is_selected); let mut style = theme.entry.style_for(state, details.is_selected).clone();
// TODO: get style from theme.
if details.is_ignored {
style.text.color.fade_out(0.6);
style.icon_color.fade_out(0.6);
}
let row_container_style = if show_editor { let row_container_style = if show_editor {
theme.filename_editor.container theme.filename_editor.container
} else { } else {

View file

@ -227,7 +227,7 @@ pub struct ProjectPanel {
pub indent_width: f32, pub indent_width: f32,
} }
#[derive(Debug, Deserialize, Default)] #[derive(Clone, Debug, Deserialize, Default)]
pub struct ProjectPanelEntry { pub struct ProjectPanelEntry {
pub height: f32, pub height: f32,
#[serde(flatten)] #[serde(flatten)]