mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-06 08:18:39 +00:00
refactor: remove unused maxReadFileLine parameter from mentions functions
This commit is contained in:
parent
3718b1c3a9
commit
9b3926d884
5 changed files with 1 additions and 111 deletions
|
|
@ -36,7 +36,6 @@ describe("Command Mentions", () => {
|
|||
false, // showRooIgnoredFiles
|
||||
true, // includeDiagnosticMessages
|
||||
50, // maxDiagnosticMessages
|
||||
undefined, // maxReadFileLine
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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: "<task>Read file with limit</task>",
|
||||
},
|
||||
]
|
||||
|
||||
await processUserContentMentions({
|
||||
userContent,
|
||||
cwd: "/test",
|
||||
urlContentFetcher: mockUrlContentFetcher,
|
||||
fileContextTracker: mockFileContextTracker,
|
||||
rooIgnoreController: mockRooIgnoreController,
|
||||
maxReadFileLine: 100,
|
||||
})
|
||||
|
||||
expect(parseMentions).toHaveBeenCalledWith(
|
||||
"<task>Read file with limit</task>",
|
||||
"/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: "<task>Read file without limit</task>",
|
||||
},
|
||||
]
|
||||
|
||||
await processUserContentMentions({
|
||||
userContent,
|
||||
cwd: "/test",
|
||||
urlContentFetcher: mockUrlContentFetcher,
|
||||
fileContextTracker: mockFileContextTracker,
|
||||
rooIgnoreController: mockRooIgnoreController,
|
||||
})
|
||||
|
||||
expect(parseMentions).toHaveBeenCalledWith(
|
||||
"<task>Read file without limit</task>",
|
||||
"/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: "<task>Read unlimited lines</task>",
|
||||
},
|
||||
]
|
||||
|
||||
await processUserContentMentions({
|
||||
userContent,
|
||||
cwd: "/test",
|
||||
urlContentFetcher: mockUrlContentFetcher,
|
||||
fileContextTracker: mockFileContextTracker,
|
||||
rooIgnoreController: mockRooIgnoreController,
|
||||
maxReadFileLine: -1,
|
||||
})
|
||||
|
||||
expect(parseMentions).toHaveBeenCalledWith(
|
||||
"<task>Read unlimited lines</task>",
|
||||
"/test",
|
||||
mockUrlContentFetcher,
|
||||
mockFileContextTracker,
|
||||
mockRooIgnoreController,
|
||||
false,
|
||||
true, // includeDiagnosticMessages
|
||||
50, // maxDiagnosticMessages
|
||||
-1,
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe("content processing", () => {
|
||||
it("should process text blocks with <task> 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,
|
||||
)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -80,7 +80,6 @@ export async function parseMentions(
|
|||
showRooIgnoredFiles: boolean = false,
|
||||
includeDiagnosticMessages: boolean = true,
|
||||
maxDiagnosticMessages: number = 50,
|
||||
maxReadFileLine?: number,
|
||||
): Promise<string> {
|
||||
const mentions: Set<string> = new Set()
|
||||
const validCommands: Map<string, Command> = 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<folder_content path="${mentionPath}">\n${content}\n</folder_content>`
|
||||
} else {
|
||||
|
|
@ -265,7 +258,6 @@ async function getFileOrFolderContent(
|
|||
cwd: string,
|
||||
rooIgnoreController?: any,
|
||||
showRooIgnoredFiles: boolean = false,
|
||||
maxReadFileLine?: number,
|
||||
): Promise<string> {
|
||||
const unescapedPath = unescapeSpaces(mentionPath)
|
||||
const absPath = path.resolve(cwd, unescapedPath)
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2168,7 +2168,6 @@ export class Task extends EventEmitter<TaskEvents> 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<TaskEvents> implements TaskLike {
|
|||
showRooIgnoredFiles,
|
||||
includeDiagnosticMessages,
|
||||
maxDiagnosticMessages,
|
||||
maxReadFileLine,
|
||||
})
|
||||
|
||||
const environmentDetails = await getEnvironmentDetails(this, currentIncludeFileDetails)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue