Repository: zed-industries/zed
File: crates/project_panel/src/project_panel.rs (Rust)

Code before:
                    .when(
                        canonical_path.is_some() || diagnostic_counts.is_some(),
                        |this| {
                            let symlink_element = canonical_path.map(|path| {
                                div()
                                    .id("symlink_icon")
                                    .tooltip(move |_window, cx| {
                                        Tooltip::with_meta(
                                            path.to_string(),
                                            None,
                                            "Symbolic Link",
                                            cx,
                                        )
                                    })
                                    .child(
                                        Icon::new(IconName::ArrowUpRight)
                                            .size(IconSize::Indicator)
                                            .color(filename_text_color),
                                    )
                            });
                            this.end_slot::<AnyElement>(
                                h_flex()
                                    .gap_1()
                                    .flex_none()
                                    .pr_3()
                                    .when_some(diagnostic_counts, |this, (errors, warnings)| {
                                        this.when(errors > 0, |this| {
                                            this.child(
                                                Label::new(errors.to_string())
                                                    .size(LabelSize::Small)
                                                    .color(Color::Error),
                                            )
                                        })
                                        .when(
                                            warnings > 0,
                                            |this| {
                                                this.child(
                                                    Label::new(warnings.to_string())
                                                        .size(LabelSize::Small)
                                                        .color(Color::Warning),
                                                )
                                            },
                                        )
                                    })
                                    .when_some(symlink_element, |this, el| this.child(el))
                                    .into_any_element(),
                            )
                        },
                    )
                    .child(if let Some(icon) = &icon {
                        if let Some((_, decoration_color)) =

Review comment (suggestion):
We should cap the displayed count so it doesn't take up too much horizontal space. Something like 99+ for anything over 99.

Code after:
                        project_panel.open_entry(entry_id, focus_opened_item, allow_preview, cx);
                    }
                }),
            )
            .child(
                ListItem::new(id)
                    .indent_level(depth)
                    .indent_step_size(px(settings.indent_size))
                    .spacing(match settings.entry_spacing {
                        ProjectPanelEntrySpacing::Comfortable => ListItemSpacing::Dense,
                        ProjectPanelEntrySpacing::Standard => ListItemSpacing::ExtraDense,
                    })
                    .selectable(false)
                    .when(
                        canonical_path.is_some() || diagnostic_count.is_some(),
                        |this| {
                            let symlink_element = canonical_path.map(|path| {
                                div()
                                    .id("symlink_icon")
                                    .tooltip(move |_window, cx| {
                                        Tooltip::with_meta(
                                            path.to_string(),
                                            None,
                                            "Symbolic Link",
                                            cx,
                                        )
                                    })
                                    .child(
                                        Icon::new(IconName::ArrowUpRight)
                                            .size(IconSize::Indicator)
                                            .color(filename_text_color),
                                    )
                            });
                            this.end_slot::<AnyElement>(
                                h_flex()
                                    .gap_1()
                                    .flex_none()
                                    .pr_3()
                                    .when_some(diagnostic_count, |this, count| {
                                        this.when(count.error_count > 0, |this| {
                                            this.child(
                                                Label::new(count.capped_error_count())
                                                    .size(LabelSize::Small)
                                                    .color(Color::Error),
                                            )
                                        })
                                        .when(
                                            count.warning_count > 0,
                                            |this| {
                                                this.child(
                                                    Label::new(count.capped_warning_count())