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.

agent_ui: Fix project rule pluralization in context usage popover (#61184)

Ibrahim Khandf9321ec8167
diff --git a/crates/agent_ui/src/completion_provider.rs b/crates/agent_ui/src/completion_provider.rs
index ccc95c2fc4e..ff6f4ca13b1 100644
--- a/crates/agent_ui/src/completion_provider.rs
+++ b/crates/agent_ui/src/completion_provider.rs
@@ -2223,7 +2223,7 @@ fn diagnostics_crease_label(
diagnostics_label(summary, include_errors, include_warnings).into()
}
-fn pluralize(noun: &str, count: usize) -> String {
+pub(crate) fn pluralize(noun: &str, count: usize) -> String {
if count == 1 {
noun.to_string()
} else {
diff --git a/crates/agent_ui/src/conversation_view/thread_view.rs b/crates/agent_ui/src/conversation_view/thread_view.rs
index 0979b9e26bf..290bebd5915 100644
--- a/crates/agent_ui/src/conversation_view/thread_view.rs
+++ b/crates/agent_ui/src/conversation_view/thread_view.rs
@@ -22,7 +22,7 @@ use cloud_api_types::{SubmitAgentThreadFeedbackBody, SubmitAgentThreadFeedbackCo
use editor::actions::OpenExcerpts;
use sandbox::{SandboxFsPolicy, SandboxNetPolicy, SandboxPolicy};
-use crate::completion_provider::{AvailableSkill, PromptLocalCommand};
+use crate::completion_provider::{AvailableSkill, PromptLocalCommand, pluralize};
use crate::message_editor::SharedSessionCapabilities;
use crate::ui::{
SandboxGroup, SandboxRow, SandboxSection, SandboxStatusTooltip, TerminalSandboxWarning,
@@ -5780,8 +5780,12 @@ impl Render for TokenUsageTooltip {
Button::new(
"open-project-rules",
format!(
- "{} project rules",
- project_rules_count
+ "{} {}",
+ project_rules_count,
+ pluralize(
+ "project rule",
+ project_rules_count
+ )
),
)
.end_icon(