mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-07 02:58:15 +00:00
fix: address PR review comments
- Fix Hindi translation punctuation - Fix race condition by checking stream.destroyed - Optimize newline counting with regex - Performance improvements for large file handling - Defensive programming for end parameter already in place
This commit is contained in:
parent
e4bac4f334
commit
8269f3a65b
2 changed files with 7 additions and 13 deletions
2
src/i18n/locales/hi/tools.json
generated
2
src/i18n/locales/hi/tools.json
generated
|
|
@ -3,7 +3,7 @@
|
|||
"linesRange": " (पंक्तियाँ {{start}}-{{end}})",
|
||||
"definitionsOnly": " (केवल परिभाषाएँ)",
|
||||
"maxLines": " (अधिकतम {{max}} पंक्तियाँ)",
|
||||
"showingOnlyLines": "कुल {{total}} पंक्तियों में से केवल {{shown}} दिखा रहे हैं। यदि आपको अधिक पंक्तियाँ पढ़नी हैं तो line_range का उपयोग करें",
|
||||
"showingOnlyLines": "कुल {{total}} पंक्तियों में से केवल {{shown}} दिखा रहे हैं। यदि आपको अधिक पंक्तियाँ पढ़नी हैं तो line_range का उपयोग करें।",
|
||||
"imageTooLarge": "छवि फ़ाइल बहुत बड़ी है ({{size}} MB)। अधिकतम अनुमतित आकार {{max}} MB है।",
|
||||
"imageWithSize": "छवि फ़ाइल ({{size}} KB)"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ export async function readPartialContent(filePath: string, maxChars: number): Pr
|
|||
let hasContent = false
|
||||
|
||||
stream.on("data", (chunk: string | Buffer) => {
|
||||
// Early exit if stream was already destroyed
|
||||
if (streamDestroyed) {
|
||||
// Check stream state immediately
|
||||
if (streamDestroyed || stream.destroyed) {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -95,11 +95,8 @@ export async function readPartialContent(filePath: string, maxChars: number): Pr
|
|||
}
|
||||
|
||||
// Count newlines in the chunk we're adding
|
||||
for (let i = 0; i < chunkToAdd.length; i++) {
|
||||
if (chunkToAdd[i] === "\n") {
|
||||
currentLine++
|
||||
}
|
||||
}
|
||||
const newlineCount = (chunkToAdd.match(/\n/g) || []).length
|
||||
currentLine += newlineCount
|
||||
|
||||
content += chunkToAdd
|
||||
|
||||
|
|
@ -114,11 +111,8 @@ export async function readPartialContent(filePath: string, maxChars: number): Pr
|
|||
// Recount lines in the final content
|
||||
currentLine = 1
|
||||
hasContent = content.length > 0
|
||||
for (let i = 0; i < content.length; i++) {
|
||||
if (content[i] === "\n") {
|
||||
currentLine++
|
||||
}
|
||||
}
|
||||
const finalNewlineCount = (content.match(/\n/g) || []).length
|
||||
currentLine += finalNewlineCount
|
||||
}
|
||||
|
||||
resolve({
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue