From 9b3926d88457c0dc164973c9825f66f0fc6bfdbf Mon Sep 17 00:00:00 2001 From: Roo Code Date: Fri, 5 Dec 2025 06:12:34 +0000 Subject: [PATCH] refactor: remove unused maxReadFileLine parameter from mentions functions --- src/__tests__/command-mentions.spec.ts | 1 - .../processUserContentMentions.spec.ts | 94 ------------------- src/core/mentions/index.ts | 10 +- .../mentions/processUserContentMentions.ts | 5 - src/core/task/Task.ts | 2 - 5 files changed, 1 insertion(+), 111 deletions(-) diff --git a/src/__tests__/command-mentions.spec.ts b/src/__tests__/command-mentions.spec.ts index 7ddaf3d092..8007688f6c 100644 --- a/src/__tests__/command-mentions.spec.ts +++ b/src/__tests__/command-mentions.spec.ts @@ -36,7 +36,6 @@ describe("Command Mentions", () => { false, // showRooIgnoredFiles true, // includeDiagnosticMessages 50, // maxDiagnosticMessages - undefined, // maxReadFileLine ) } diff --git a/src/core/mentions/__tests__/processUserContentMentions.spec.ts b/src/core/mentions/__tests__/processUserContentMentions.spec.ts index 13c225042d..593eb7e05c 100644 --- a/src/core/mentions/__tests__/processUserContentMentions.spec.ts +++ b/src/core/mentions/__tests__/processUserContentMentions.spec.ts @@ -26,97 +26,6 @@ describe("processUserContentMentions", () => { vi.mocked(parseMentions).mockImplementation(async (text) => `parsed: ${text}`) }) - describe("maxReadFileLine parameter", () => { - it("should pass maxReadFileLine to parseMentions when provided", async () => { - const userContent = [ - { - type: "text" as const, - text: "Read file with limit", - }, - ] - - await processUserContentMentions({ - userContent, - cwd: "/test", - urlContentFetcher: mockUrlContentFetcher, - fileContextTracker: mockFileContextTracker, - rooIgnoreController: mockRooIgnoreController, - maxReadFileLine: 100, - }) - - expect(parseMentions).toHaveBeenCalledWith( - "Read file with limit", - "/test", - mockUrlContentFetcher, - mockFileContextTracker, - mockRooIgnoreController, - false, - true, // includeDiagnosticMessages - 50, // maxDiagnosticMessages - 100, - ) - }) - - it("should pass undefined maxReadFileLine when not provided", async () => { - const userContent = [ - { - type: "text" as const, - text: "Read file without limit", - }, - ] - - await processUserContentMentions({ - userContent, - cwd: "/test", - urlContentFetcher: mockUrlContentFetcher, - fileContextTracker: mockFileContextTracker, - rooIgnoreController: mockRooIgnoreController, - }) - - expect(parseMentions).toHaveBeenCalledWith( - "Read file without limit", - "/test", - mockUrlContentFetcher, - mockFileContextTracker, - mockRooIgnoreController, - false, - true, // includeDiagnosticMessages - 50, // maxDiagnosticMessages - undefined, - ) - }) - - it("should handle UNLIMITED_LINES constant correctly", async () => { - const userContent = [ - { - type: "text" as const, - text: "Read unlimited lines", - }, - ] - - await processUserContentMentions({ - userContent, - cwd: "/test", - urlContentFetcher: mockUrlContentFetcher, - fileContextTracker: mockFileContextTracker, - rooIgnoreController: mockRooIgnoreController, - maxReadFileLine: -1, - }) - - expect(parseMentions).toHaveBeenCalledWith( - "Read unlimited lines", - "/test", - mockUrlContentFetcher, - mockFileContextTracker, - mockRooIgnoreController, - false, - true, // includeDiagnosticMessages - 50, // maxDiagnosticMessages - -1, - ) - }) - }) - describe("content processing", () => { it("should process text blocks with tags", async () => { const userContent = [ @@ -273,7 +182,6 @@ describe("processUserContentMentions", () => { cwd: "/test", urlContentFetcher: mockUrlContentFetcher, fileContextTracker: mockFileContextTracker, - maxReadFileLine: 50, }) expect(parseMentions).toHaveBeenCalledTimes(2) @@ -316,7 +224,6 @@ describe("processUserContentMentions", () => { false, // showRooIgnoredFiles should default to false true, // includeDiagnosticMessages 50, // maxDiagnosticMessages - undefined, ) }) @@ -345,7 +252,6 @@ describe("processUserContentMentions", () => { false, true, // includeDiagnosticMessages 50, // maxDiagnosticMessages - undefined, ) }) }) diff --git a/src/core/mentions/index.ts b/src/core/mentions/index.ts index 5a6756d055..71f6427041 100644 --- a/src/core/mentions/index.ts +++ b/src/core/mentions/index.ts @@ -80,7 +80,6 @@ export async function parseMentions( showRooIgnoredFiles: boolean = false, includeDiagnosticMessages: boolean = true, maxDiagnosticMessages: number = 50, - maxReadFileLine?: number, ): Promise { const mentions: Set = new Set() const validCommands: Map = new Map() @@ -182,13 +181,7 @@ export async function parseMentions( } else if (mention.startsWith("/")) { const mentionPath = mention.slice(1) try { - const content = await getFileOrFolderContent( - mentionPath, - cwd, - rooIgnoreController, - showRooIgnoredFiles, - maxReadFileLine, - ) + const content = await getFileOrFolderContent(mentionPath, cwd, rooIgnoreController, showRooIgnoredFiles) if (mention.endsWith("/")) { parsedText += `\n\n\n${content}\n` } else { @@ -265,7 +258,6 @@ async function getFileOrFolderContent( cwd: string, rooIgnoreController?: any, showRooIgnoredFiles: boolean = false, - maxReadFileLine?: number, ): Promise { const unescapedPath = unescapeSpaces(mentionPath) const absPath = path.resolve(cwd, unescapedPath) diff --git a/src/core/mentions/processUserContentMentions.ts b/src/core/mentions/processUserContentMentions.ts index 4bdb422d48..fcba75396f 100644 --- a/src/core/mentions/processUserContentMentions.ts +++ b/src/core/mentions/processUserContentMentions.ts @@ -15,7 +15,6 @@ export async function processUserContentMentions({ showRooIgnoredFiles = false, includeDiagnosticMessages = true, maxDiagnosticMessages = 50, - maxReadFileLine, }: { userContent: Anthropic.Messages.ContentBlockParam[] cwd: string @@ -25,7 +24,6 @@ export async function processUserContentMentions({ showRooIgnoredFiles?: boolean includeDiagnosticMessages?: boolean maxDiagnosticMessages?: number - maxReadFileLine?: number }) { // Process userContent array, which contains various block types: // TextBlockParam, ImageBlockParam, ToolUseBlockParam, and ToolResultBlockParam. @@ -58,7 +56,6 @@ export async function processUserContentMentions({ showRooIgnoredFiles, includeDiagnosticMessages, maxDiagnosticMessages, - maxReadFileLine, ), } } @@ -78,7 +75,6 @@ export async function processUserContentMentions({ showRooIgnoredFiles, includeDiagnosticMessages, maxDiagnosticMessages, - maxReadFileLine, ), } } @@ -99,7 +95,6 @@ export async function processUserContentMentions({ showRooIgnoredFiles, includeDiagnosticMessages, maxDiagnosticMessages, - maxReadFileLine, ), } } diff --git a/src/core/task/Task.ts b/src/core/task/Task.ts index 493263b9d4..8beed65504 100644 --- a/src/core/task/Task.ts +++ b/src/core/task/Task.ts @@ -2168,7 +2168,6 @@ export class Task extends EventEmitter implements TaskLike { showRooIgnoredFiles = false, includeDiagnosticMessages = true, maxDiagnosticMessages = 50, - maxReadFileLine = -1, } = (await this.providerRef.deref()?.getState()) ?? {} const parsedUserContent = await processUserContentMentions({ @@ -2180,7 +2179,6 @@ export class Task extends EventEmitter implements TaskLike { showRooIgnoredFiles, includeDiagnosticMessages, maxDiagnosticMessages, - maxReadFileLine, }) const environmentDetails = await getEnvironmentDetails(this, currentIncludeFileDetails)