fix: bypass maxReadFileLine for @ mentioned files

When a user explicitly @ mentions a file, they expect to see the full
content regardless of the maxReadFileLine setting. This change ensures
that @ mentioned files always use -1 (unlimited) for maxReadFileLine,
bypassing the auto-truncate threshold.

Changes:
- Modified getFileOrFolderContent to always pass -1 to extractTextFromFile
- This applies to both individual file mentions and files in folder mentions
- The maxReadFileLine setting continues to work for tool-based file reads
This commit is contained in:
Roo Code 2025-12-04 20:59:49 +00:00
parent ae655c5d29
commit 3718b1c3a9

View file

@ -278,7 +278,8 @@ async function getFileOrFolderContent(
return `(File ${mentionPath} is ignored by .rooignore)`
}
try {
const content = await extractTextFromFile(absPath, maxReadFileLine)
// Always read full file for @ mentions (bypass maxReadFileLine)
const content = await extractTextFromFile(absPath, -1)
return content
} catch (error) {
return `(Failed to read contents of ${mentionPath}): ${error.message}`
@ -318,7 +319,8 @@ async function getFileOrFolderContent(
if (isBinary) {
return undefined
}
const content = await extractTextFromFile(absoluteFilePath, maxReadFileLine)
// Always read full file for @ mentions (bypass maxReadFileLine)
const content = await extractTextFromFile(absoluteFilePath, -1)
return `<file_content path="${filePath.toPosix()}">\n${content}\n</file_content>`
} catch (error) {
return undefined