mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Display info about partial reads in chat row (#2080)
This commit is contained in:
parent
e15fa227c5
commit
9bb50eaba3
17 changed files with 155 additions and 3 deletions
|
|
@ -3,6 +3,7 @@ import { Cline } from "../Cline"
|
|||
import { ClineSayTool } from "../../shared/ExtensionMessage"
|
||||
import { ToolUse } from "../assistant-message"
|
||||
import { formatResponse } from "../prompts/responses"
|
||||
import { t } from "../../i18n"
|
||||
import { AskApproval, HandleError, PushToolResult, RemoveClosingTag } from "./types"
|
||||
import { isPathOutsideWorkspace } from "../../utils/pathUtils"
|
||||
import { getReadablePath } from "../../utils/path"
|
||||
|
|
@ -97,11 +98,29 @@ export async function readFileTool(
|
|||
break
|
||||
}
|
||||
|
||||
const { maxReadFileLine = 500 } = (await cline.providerRef.deref()?.getState()) ?? {}
|
||||
|
||||
// Create line snippet description for approval message
|
||||
let lineSnippet = ""
|
||||
if (startLine !== undefined && endLine !== undefined) {
|
||||
lineSnippet = t("tools:readFile.linesRange", { start: startLine + 1, end: endLine + 1 })
|
||||
} else if (startLine !== undefined) {
|
||||
lineSnippet = t("tools:readFile.linesFromToEnd", { start: startLine + 1 })
|
||||
} else if (endLine !== undefined) {
|
||||
lineSnippet = t("tools:readFile.linesFromStartTo", { end: endLine + 1 })
|
||||
} else if (maxReadFileLine === 0) {
|
||||
lineSnippet = t("tools:readFile.definitionsOnly")
|
||||
} else if (maxReadFileLine > 0) {
|
||||
lineSnippet = t("tools:readFile.maxLines", { max: maxReadFileLine })
|
||||
}
|
||||
|
||||
cline.consecutiveMistakeCount = 0
|
||||
const absolutePath = path.resolve(cline.cwd, relPath)
|
||||
|
||||
const completeMessage = JSON.stringify({
|
||||
...sharedMessageProps,
|
||||
content: absolutePath,
|
||||
reason: lineSnippet,
|
||||
} satisfies ClineSayTool)
|
||||
|
||||
const didApprove = await askApproval("tool", completeMessage)
|
||||
|
|
@ -109,9 +128,6 @@ export async function readFileTool(
|
|||
break
|
||||
}
|
||||
|
||||
// Get the maxReadFileLine setting
|
||||
const { maxReadFileLine = 500 } = (await cline.providerRef.deref()?.getState()) ?? {}
|
||||
|
||||
// Count total lines in the file
|
||||
let totalLines = 0
|
||||
try {
|
||||
|
|
|
|||
9
src/i18n/locales/ca/tools.json
Normal file
9
src/i18n/locales/ca/tools.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"readFile": {
|
||||
"linesRange": " (línies {{start}}-{{end}})",
|
||||
"linesFromToEnd": " (línies {{start}}-final)",
|
||||
"linesFromStartTo": " (línies 1-{{end}})",
|
||||
"definitionsOnly": " (només definicions)",
|
||||
"maxLines": " (màxim {{max}} línies)"
|
||||
}
|
||||
}
|
||||
9
src/i18n/locales/de/tools.json
Normal file
9
src/i18n/locales/de/tools.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"readFile": {
|
||||
"linesRange": " (Zeilen {{start}}-{{end}})",
|
||||
"linesFromToEnd": " (Zeilen {{start}}-Ende)",
|
||||
"linesFromStartTo": " (Zeilen 1-{{end}})",
|
||||
"definitionsOnly": " (nur Definitionen)",
|
||||
"maxLines": " (maximal {{max}} Zeilen)"
|
||||
}
|
||||
}
|
||||
9
src/i18n/locales/en/tools.json
Normal file
9
src/i18n/locales/en/tools.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"readFile": {
|
||||
"linesRange": " (lines {{start}}-{{end}})",
|
||||
"linesFromToEnd": " (lines {{start}}-end)",
|
||||
"linesFromStartTo": " (lines 1-{{end}})",
|
||||
"definitionsOnly": " (definitions only)",
|
||||
"maxLines": " (max {{max}} lines)"
|
||||
}
|
||||
}
|
||||
9
src/i18n/locales/es/tools.json
Normal file
9
src/i18n/locales/es/tools.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"readFile": {
|
||||
"linesRange": " (líneas {{start}}-{{end}})",
|
||||
"linesFromToEnd": " (líneas {{start}}-final)",
|
||||
"linesFromStartTo": " (líneas 1-{{end}})",
|
||||
"definitionsOnly": " (solo definiciones)",
|
||||
"maxLines": " (máximo {{max}} líneas)"
|
||||
}
|
||||
}
|
||||
9
src/i18n/locales/fr/tools.json
Normal file
9
src/i18n/locales/fr/tools.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"readFile": {
|
||||
"linesRange": " (lignes {{start}}-{{end}})",
|
||||
"linesFromToEnd": " (lignes {{start}}-fin)",
|
||||
"linesFromStartTo": " (lignes 1-{{end}})",
|
||||
"definitionsOnly": " (définitions uniquement)",
|
||||
"maxLines": " (max {{max}} lignes)"
|
||||
}
|
||||
}
|
||||
9
src/i18n/locales/hi/tools.json
Normal file
9
src/i18n/locales/hi/tools.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"readFile": {
|
||||
"linesRange": " (पंक्तियाँ {{start}}-{{end}})",
|
||||
"linesFromToEnd": " (पंक्तियाँ {{start}}-अंत)",
|
||||
"linesFromStartTo": " (पंक्तियाँ 1-{{end}})",
|
||||
"definitionsOnly": " (केवल परिभाषाएँ)",
|
||||
"maxLines": " (अधिकतम {{max}} पंक्तियाँ)"
|
||||
}
|
||||
}
|
||||
9
src/i18n/locales/it/tools.json
Normal file
9
src/i18n/locales/it/tools.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"readFile": {
|
||||
"linesRange": " (righe {{start}}-{{end}})",
|
||||
"linesFromToEnd": " (righe {{start}}-fine)",
|
||||
"linesFromStartTo": " (righe 1-{{end}})",
|
||||
"definitionsOnly": " (solo definizioni)",
|
||||
"maxLines": " (max {{max}} righe)"
|
||||
}
|
||||
}
|
||||
9
src/i18n/locales/ja/tools.json
Normal file
9
src/i18n/locales/ja/tools.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"readFile": {
|
||||
"linesRange": " ({{start}}-{{end}}行目)",
|
||||
"linesFromToEnd": " ({{start}}行目-最後まで)",
|
||||
"linesFromStartTo": " (1-{{end}}行目)",
|
||||
"definitionsOnly": " (定義のみ)",
|
||||
"maxLines": " (最大{{max}}行)"
|
||||
}
|
||||
}
|
||||
9
src/i18n/locales/ko/tools.json
Normal file
9
src/i18n/locales/ko/tools.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"readFile": {
|
||||
"linesRange": " ({{start}}-{{end}}행)",
|
||||
"linesFromToEnd": " ({{start}}행-끝)",
|
||||
"linesFromStartTo": " (1-{{end}}행)",
|
||||
"definitionsOnly": " (정의만)",
|
||||
"maxLines": " (최대 {{max}}행)"
|
||||
}
|
||||
}
|
||||
9
src/i18n/locales/pl/tools.json
Normal file
9
src/i18n/locales/pl/tools.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"readFile": {
|
||||
"linesRange": " (linie {{start}}-{{end}})",
|
||||
"linesFromToEnd": " (linie {{start}}-koniec)",
|
||||
"linesFromStartTo": " (linie 1-{{end}})",
|
||||
"definitionsOnly": " (tylko definicje)",
|
||||
"maxLines": " (maks. {{max}} linii)"
|
||||
}
|
||||
}
|
||||
9
src/i18n/locales/pt-BR/tools.json
Normal file
9
src/i18n/locales/pt-BR/tools.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"readFile": {
|
||||
"linesRange": " (linhas {{start}}-{{end}})",
|
||||
"linesFromToEnd": " (linhas {{start}}-fim)",
|
||||
"linesFromStartTo": " (linhas 1-{{end}})",
|
||||
"definitionsOnly": " (apenas definições)",
|
||||
"maxLines": " (máx. {{max}} linhas)"
|
||||
}
|
||||
}
|
||||
9
src/i18n/locales/tr/tools.json
Normal file
9
src/i18n/locales/tr/tools.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"readFile": {
|
||||
"linesRange": " (satır {{start}}-{{end}})",
|
||||
"linesFromToEnd": " (satır {{start}}-son)",
|
||||
"linesFromStartTo": " (satır 1-{{end}})",
|
||||
"definitionsOnly": " (sadece tanımlar)",
|
||||
"maxLines": " (maks. {{max}} satır)"
|
||||
}
|
||||
}
|
||||
9
src/i18n/locales/vi/tools.json
Normal file
9
src/i18n/locales/vi/tools.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"readFile": {
|
||||
"linesRange": " (dòng {{start}}-{{end}})",
|
||||
"linesFromToEnd": " (dòng {{start}}-cuối)",
|
||||
"linesFromStartTo": " (dòng 1-{{end}})",
|
||||
"definitionsOnly": " (chỉ định nghĩa)",
|
||||
"maxLines": " (tối đa {{max}} dòng)"
|
||||
}
|
||||
}
|
||||
9
src/i18n/locales/zh-CN/tools.json
Normal file
9
src/i18n/locales/zh-CN/tools.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"readFile": {
|
||||
"linesRange": " (第 {{start}}-{{end}} 行)",
|
||||
"linesFromToEnd": " (第 {{start}} 行至末尾)",
|
||||
"linesFromStartTo": " (第 1-{{end}} 行)",
|
||||
"definitionsOnly": " (仅定义)",
|
||||
"maxLines": " (最多 {{max}} 行)"
|
||||
}
|
||||
}
|
||||
9
src/i18n/locales/zh-TW/tools.json
Normal file
9
src/i18n/locales/zh-TW/tools.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"readFile": {
|
||||
"linesRange": " (第 {{start}}-{{end}} 行)",
|
||||
"linesFromToEnd": " (第 {{start}} 行至末尾)",
|
||||
"linesFromStartTo": " (第 1-{{end}} 行)",
|
||||
"definitionsOnly": " (僅定義)",
|
||||
"maxLines": " (最多 {{max}} 行)"
|
||||
}
|
||||
}
|
||||
|
|
@ -356,6 +356,7 @@ export const ChatRowContent = ({
|
|||
textAlign: "left",
|
||||
}}>
|
||||
{removeLeadingNonAlphanumeric(tool.path ?? "") + "\u200E"}
|
||||
{tool.reason}
|
||||
</span>
|
||||
<div style={{ flexGrow: 1 }}></div>
|
||||
<span
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue