Skip to content

Commit b96d740

Browse files
committed
Show LLM streaming file write content
1 parent 104f81f commit b96d740

File tree

11 files changed

+128
-175
lines changed

11 files changed

+128
-175
lines changed

evals/packages/types/src/roo-code-defaults.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export const rooCodeDefaults: RooCodeSettings = {
44
apiProvider: "openrouter",
55
openRouterUseMiddleOutTransform: false,
66

7-
lastShownAnnouncementId: "apr-30-2025-3-15",
7+
lastShownAnnouncementId: "may-06-2025-3-16",
88

99
pinnedApiConfigs: {},
1010

@@ -42,7 +42,7 @@ export const rooCodeDefaults: RooCodeSettings = {
4242
terminalZshP10k: false,
4343
terminalZdotdir: true,
4444
terminalCompressProgressBar: true,
45-
terminalShellIntegrationDisabled: true,
45+
terminalShellIntegrationDisabled: false,
4646

4747
diffEnabled: true,
4848
fuzzyMatchThreshold: 1,
@@ -53,7 +53,7 @@ export const rooCodeDefaults: RooCodeSettings = {
5353
maxOpenTabsContext: 20,
5454
maxWorkspaceFiles: 200,
5555
showRooIgnoredFiles: true,
56-
maxReadFileLine: 500,
56+
maxReadFileLine: 500, // -1 to enable full file reading.
5757

5858
language: "en",
5959
telemetrySetting: "enabled",

src/core/tools/applyDiffTool.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export async function applyDiffTool(
3131
const sharedMessageProps: ClineSayTool = {
3232
tool: "appliedDiff",
3333
path: getReadablePath(cline.cwd, removeClosingTag("path", relPath)),
34+
diff: diffContent,
3435
}
3536

3637
try {
@@ -46,8 +47,10 @@ export async function applyDiffTool(
4647
return
4748
}
4849

49-
const partialMessage = JSON.stringify(sharedMessageProps)
50-
await cline.ask("tool", partialMessage, block.partial, toolProgressStatus).catch(() => {})
50+
await cline
51+
.ask("tool", JSON.stringify(sharedMessageProps), block.partial, toolProgressStatus)
52+
.catch(() => {})
53+
5154
return
5255
} else {
5356
if (!relPath) {

src/core/tools/insertContentTool.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ export async function insertContentTool(
2626
const sharedMessageProps: ClineSayTool = {
2727
tool: "insertContent",
2828
path: getReadablePath(cline.cwd, removeClosingTag("path", relPath)),
29+
diff: content,
2930
lineNumber: line ? parseInt(line, 10) : undefined,
3031
}
3132

3233
try {
3334
if (block.partial) {
34-
const partialMessage = JSON.stringify(sharedMessageProps)
35-
await cline.ask("tool", partialMessage, block.partial).catch(() => {})
35+
await cline.ask("tool", JSON.stringify(sharedMessageProps), block.partial).catch(() => {})
3636
return
3737
}
3838

@@ -145,14 +145,15 @@ export async function insertContentTool(
145145
return
146146
}
147147

148-
const userFeedbackDiff = JSON.stringify({
149-
tool: "insertContent",
150-
path: getReadablePath(cline.cwd, relPath),
151-
lineNumber: lineNumber,
152-
diff: userEdits,
153-
} satisfies ClineSayTool)
154-
155-
await cline.say("user_feedback_diff", userFeedbackDiff)
148+
await cline.say(
149+
"user_feedback_diff",
150+
JSON.stringify({
151+
tool: "insertContent",
152+
path: getReadablePath(cline.cwd, relPath),
153+
diff: userEdits,
154+
lineNumber: lineNumber,
155+
} satisfies ClineSayTool),
156+
)
156157

157158
pushToolResult(
158159
`The user made the following updates to your content:\n\n${userEdits}\n\n` +

src/core/tools/searchAndReplaceTool.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,14 @@ export async function searchAndReplaceTool(
226226
return
227227
}
228228

229-
const userFeedbackDiff = JSON.stringify({
230-
tool: "appliedDiff",
231-
path: getReadablePath(cline.cwd, relPath),
232-
diff: userEdits,
233-
} satisfies ClineSayTool)
234-
235-
await cline.say("user_feedback_diff", userFeedbackDiff)
229+
await cline.say(
230+
"user_feedback_diff",
231+
JSON.stringify({
232+
tool: "appliedDiff",
233+
path: getReadablePath(cline.cwd, relPath),
234+
diff: userEdits,
235+
} satisfies ClineSayTool),
236+
)
236237

237238
// Format and send response with user's updates
238239
const resultMessage = [

src/core/tools/writeToFileTool.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export async function writeToFileTool(
7272
const sharedMessageProps: ClineSayTool = {
7373
tool: fileExists ? "editedExistingFile" : "newFileCreated",
7474
path: getReadablePath(cline.cwd, removeClosingTag("path", relPath)),
75+
content: newContent,
7576
isOutsideWorkspace,
7677
}
7778

webview-ui/src/components/chat/ChatRow.tsx

Lines changed: 33 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ import { useCopyToClipboard } from "@src/utils/clipboard"
1212
import { useExtensionState } from "@src/context/ExtensionStateContext"
1313
import { findMatchingResourceOrTemplate } from "@src/utils/mcp"
1414
import { vscode } from "@src/utils/vscode"
15+
import { removeLeadingNonAlphanumeric } from "@src/utils/removeLeadingNonAlphanumeric"
1516
import { Button } from "@src/components/ui"
1617

17-
import CodeAccordian, { removeLeadingNonAlphanumeric } from "../common/CodeAccordian"
18-
import CodeBlock, { CODE_BLOCK_BG_COLOR } from "../common/CodeBlock"
18+
import { ToolUseBlock, ToolUseBlockHeader } from "../common/ToolUseBlock"
19+
import CodeAccordian from "../common/CodeAccordian"
20+
import CodeBlock from "../common/CodeBlock"
1921
import MarkdownBlock from "../common/MarkdownBlock"
2022
import { ReasoningBlock } from "./ReasoningBlock"
2123
import Thumbnails from "../common/Thumbnails"
@@ -287,10 +289,11 @@ export const ChatRowContent = ({
287289
</span>
288290
</div>
289291
<CodeAccordian
292+
path={tool.path}
293+
code={tool.content ?? tool.diff}
294+
language={tool.tool === "appliedDiff" ? "diff" : undefined}
290295
progressStatus={message.progressStatus}
291296
isLoading={message.partial}
292-
diff={tool.diff!}
293-
path={tool.path!}
294297
isExpanded={isExpanded}
295298
onToggleExpand={onToggleExpand}
296299
/>
@@ -312,10 +315,11 @@ export const ChatRowContent = ({
312315
</span>
313316
</div>
314317
<CodeAccordian
318+
path={tool.path}
319+
code={tool.diff}
320+
language="diff"
315321
progressStatus={message.progressStatus}
316322
isLoading={message.partial}
317-
diff={tool.diff!}
318-
path={tool.path!}
319323
isExpanded={isExpanded}
320324
onToggleExpand={onToggleExpand}
321325
/>
@@ -333,10 +337,10 @@ export const ChatRowContent = ({
333337
</span>
334338
</div>
335339
<CodeAccordian
340+
path={tool.path}
341+
code={tool.diff}
336342
progressStatus={message.progressStatus}
337343
isLoading={message.partial}
338-
diff={tool.diff!}
339-
path={tool.path!}
340344
isExpanded={isExpanded}
341345
onToggleExpand={onToggleExpand}
342346
/>
@@ -350,9 +354,9 @@ export const ChatRowContent = ({
350354
<span style={{ fontWeight: "bold" }}>{t("chat:fileOperations.wantsToCreate")}</span>
351355
</div>
352356
<CodeAccordian
357+
path={tool.path}
358+
code={tool.content}
353359
isLoading={message.partial}
354-
code={tool.content!}
355-
path={tool.path!}
356360
isExpanded={isExpanded}
357361
onToggleExpand={onToggleExpand}
358362
/>
@@ -371,47 +375,21 @@ export const ChatRowContent = ({
371375
: t("chat:fileOperations.didRead")}
372376
</span>
373377
</div>
374-
<div
375-
style={{
376-
borderRadius: 3,
377-
backgroundColor: CODE_BLOCK_BG_COLOR,
378-
overflow: "hidden",
379-
border: "1px solid var(--vscode-editorGroup-border)",
380-
}}>
381-
<div
382-
style={{
383-
color: "var(--vscode-descriptionForeground)",
384-
display: "flex",
385-
alignItems: "center",
386-
padding: "9px 10px",
387-
cursor: "pointer",
388-
userSelect: "none",
389-
WebkitUserSelect: "none",
390-
MozUserSelect: "none",
391-
msUserSelect: "none",
392-
}}
393-
onClick={() => {
394-
vscode.postMessage({ type: "openFile", text: tool.content })
395-
}}>
378+
<ToolUseBlock>
379+
<ToolUseBlockHeader
380+
onClick={() => vscode.postMessage({ type: "openFile", text: tool.content })}>
396381
{tool.path?.startsWith(".") && <span>.</span>}
397-
<span
398-
style={{
399-
whiteSpace: "nowrap",
400-
overflow: "hidden",
401-
textOverflow: "ellipsis",
402-
marginRight: "8px",
403-
direction: "rtl",
404-
textAlign: "left",
405-
}}>
382+
<span className="whitespace-nowrap overflow-hidden text-ellipsis text-left mr-2 rtl">
406383
{removeLeadingNonAlphanumeric(tool.path ?? "") + "\u200E"}
407384
{tool.reason}
408385
</span>
409386
<div style={{ flexGrow: 1 }}></div>
410387
<span
411388
className={`codicon codicon-link-external`}
412-
style={{ fontSize: 13.5, margin: "1px 0" }}></span>
413-
</div>
414-
</div>
389+
style={{ fontSize: 13.5, margin: "1px 0" }}
390+
/>
391+
</ToolUseBlockHeader>
392+
</ToolUseBlock>
415393
</>
416394
)
417395
case "fetchInstructions":
@@ -422,8 +400,8 @@ export const ChatRowContent = ({
422400
<span style={{ fontWeight: "bold" }}>{t("chat:instructions.wantsToFetch")}</span>
423401
</div>
424402
<CodeAccordian
403+
code={tool.content}
425404
isLoading={message.partial}
426-
code={tool.content!}
427405
isExpanded={isExpanded}
428406
onToggleExpand={onToggleExpand}
429407
/>
@@ -441,8 +419,8 @@ export const ChatRowContent = ({
441419
</span>
442420
</div>
443421
<CodeAccordian
444-
code={tool.content!}
445-
path={tool.path!}
422+
path={tool.path}
423+
code={tool.content}
446424
language="shell-session"
447425
isExpanded={isExpanded}
448426
onToggleExpand={onToggleExpand}
@@ -461,8 +439,8 @@ export const ChatRowContent = ({
461439
</span>
462440
</div>
463441
<CodeAccordian
464-
code={tool.content!}
465-
path={tool.path!}
442+
path={tool.path}
443+
code={tool.content}
466444
language="shell-session"
467445
isExpanded={isExpanded}
468446
onToggleExpand={onToggleExpand}
@@ -481,8 +459,8 @@ export const ChatRowContent = ({
481459
</span>
482460
</div>
483461
<CodeAccordian
484-
code={tool.content!}
485-
path={tool.path!}
462+
path={tool.path}
463+
code={tool.content}
486464
isExpanded={isExpanded}
487465
onToggleExpand={onToggleExpand}
488466
/>
@@ -510,8 +488,8 @@ export const ChatRowContent = ({
510488
</span>
511489
</div>
512490
<CodeAccordian
513-
code={tool.content!}
514491
path={tool.path! + (tool.filePattern ? `/(${tool.filePattern})` : "")}
492+
code={tool.content}
515493
language="log"
516494
isExpanded={isExpanded}
517495
onToggleExpand={onToggleExpand}
@@ -881,13 +859,10 @@ export const ChatRowContent = ({
881859
case "user_feedback_diff":
882860
const tool = safeJsonParse<ClineSayTool>(message.text)
883861
return (
884-
<div
885-
style={{
886-
marginTop: -10,
887-
width: "100%",
888-
}}>
862+
<div style={{ marginTop: -10, width: "100%" }}>
889863
<CodeAccordian
890-
diff={tool?.diff!}
864+
code={tool?.diff}
865+
language="diff"
891866
isFeedback={true}
892867
isExpanded={isExpanded}
893868
onToggleExpand={onToggleExpand}

webview-ui/src/components/chat/CommandExecution.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export const CommandExecution = ({ executionId, text }: CommandExecutionProps) =
8585
}, [status, text])
8686

8787
return (
88-
<div className="w-full bg-vscode-editor-background border border-vscode-border rounded-xs p-2">
88+
<div className="w-full bg-vscode-editor-background border border-vscode-border rounded-xs p-1">
8989
<div className="flex flex-row items-center justify-between gap-2 px-1">
9090
<Line className="text-sm whitespace-nowrap overflow-hidden text-ellipsis">{command}</Line>
9191
<div className="flex flex-row items-center gap-1">

webview-ui/src/components/chat/ContextMenu.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import React, { useEffect, useMemo, useRef, useState } from "react"
22
import { getIconForFilePath, getIconUrlByName, getIconForDirectoryPath } from "vscode-material-icons"
3+
4+
import { ModeConfig } from "@roo/shared/modes"
5+
36
import {
47
ContextMenuOptionType,
58
ContextMenuQueryItem,
69
getContextMenuOptions,
710
SearchResult,
811
} from "@src/utils/context-mentions"
9-
import { removeLeadingNonAlphanumeric } from "../common/CodeAccordian"
10-
import { ModeConfig } from "@roo/shared/modes"
12+
import { removeLeadingNonAlphanumeric } from "@src/utils/removeLeadingNonAlphanumeric"
1113

1214
interface ContextMenuProps {
1315
onSelect: (type: ContextMenuOptionType, value?: string) => void

0 commit comments

Comments
 (0)