Skip to content
TypeScript

fix(cursor): grep count results say "1 match", not "1 matches" (#26065)

MarcoDotIOa83ab55e80db
diff --git a/packages/provider-cursor/src/server/adapter.test.ts b/packages/provider-cursor/src/server/adapter.test.ts
index 062089fffa0..790dd0e4415 100644
--- a/packages/provider-cursor/src/server/adapter.test.ts
+++ b/packages/provider-cursor/src/server/adapter.test.ts
@@ -865,6 +865,32 @@ describe("CursorAdapterV2", () => {
result: { status: "error", error: "search failed" },
},
},
+ {
+ type: "tool-call-completed",
+ modelCallId: "native-model-call",
+ callId: "grep-counts",
+ toolCall: {
+ type: "grep",
+ args: { pattern: "TODO", outputMode: "count" },
+ result: {
+ status: "success",
+ value: {
+ workspaceResults: {
+ [workspace]: {
+ type: "count",
+ output: {
+ counts: [
+ { file: "src/a.ts", count: 1 },
+ { file: "src/b.ts", count: 3 },
+ ],
+ total: 4,
+ },
+ },
+ },
+ },
+ },
+ },
+ },
{
type: "tool-call-completed",
modelCallId: "native-model-call",
@@ -1115,6 +1141,14 @@ describe("CursorAdapterV2", () => {
status: "failed",
results: [{ fileName: "src", preview: "search failed" }],
},
+ {
+ pattern: "TODO",
+ status: "completed",
+ results: [
+ { fileName: "src/a.ts", preview: "1 match" },
+ { fileName: "src/b.ts", preview: "3 matches" },
+ ],
+ },
{
pattern: "*.ts",
status: "failed",
diff --git a/packages/provider-cursor/src/server/adapter.ts b/packages/provider-cursor/src/server/adapter.ts
index 72aca919b25..03f346d9a6d 100644
--- a/packages/provider-cursor/src/server/adapter.ts
+++ b/packages/provider-cursor/src/server/adapter.ts
@@ -477,7 +477,7 @@ function cursorToolSearchResults(
if (result.type === "count") {
return result.output.counts.map((entry) => ({
fileName: entry.file,
- preview: `${entry.count} matches`,
+ preview: `${entry.count} ${entry.count === 1 ? "match" : "matches"}`,
}));
}
return result.output.matches.map((entry) => ({