Skip to content

Commit 547387f

Browse files
committed
Show diffs in todo list updates
1 parent 0f5340b commit 547387f

File tree

21 files changed

+861
-223
lines changed

21 files changed

+861
-223
lines changed

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export const ChatRowContent = ({
107107
editable,
108108
}: ChatRowContentProps) => {
109109
const { t } = useTranslation()
110-
const { mcpServers, alwaysAllowMcp, currentCheckpoint } = useExtensionState()
110+
const { mcpServers, alwaysAllowMcp, currentCheckpoint, clineMessages } = useExtensionState()
111111
const [reasoningCollapsed, setReasoningCollapsed] = useState(true)
112112
const [isDiffErrorExpanded, setIsDiffErrorExpanded] = useState(false)
113113
const [showCopySuccess, setShowCopySuccess] = useState(false)
@@ -436,9 +436,31 @@ export const ChatRowContent = ({
436436
}
437437
case "updateTodoList" as any: {
438438
const todos = (tool as any).todos || []
439+
440+
// Try to find previous todo list from earlier messages
441+
const currentMessageIndex = clineMessages.findIndex((msg) => msg.ts === message.ts)
442+
let previousTodos: any[] = []
443+
444+
// Look backwards through messages to find the most recent updateTodoList
445+
for (let i = currentMessageIndex - 1; i >= 0; i--) {
446+
const prevMessage = clineMessages[i]
447+
if (prevMessage.ask === "tool" && prevMessage.text) {
448+
try {
449+
const prevTool = JSON.parse(prevMessage.text)
450+
if (prevTool.tool === "updateTodoList" && prevTool.todos) {
451+
previousTodos = prevTool.todos
452+
break
453+
}
454+
} catch {
455+
// Ignore parsing errors
456+
}
457+
}
458+
}
459+
439460
return (
440461
<UpdateTodoListToolBlock
441462
todos={todos}
463+
previousTodos={previousTodos}
442464
content={(tool as any).content}
443465
onChange={(updatedTodos) => {
444466
if (typeof vscode !== "undefined" && vscode?.postMessage) {

0 commit comments

Comments
 (0)