diff options
| author | Adam <[email protected]> | 2026-02-26 18:23:04 -0600 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-02-26 18:23:04 -0600 |
| commit | fc52e4b2d3a41efde772e6de8fb2e01f27821701 (patch) | |
| tree | cf23af294a00a10e55f230232585344c111f0bb9 /packages/ui/src/components/message-part.tsx | |
| parent | 9a6bfeb782766099d4ce3a98bb9e7b4e79f8bfe6 (diff) | |
| download | opencode-fc52e4b2d3a41efde772e6de8fb2e01f27821701.tar.gz opencode-fc52e4b2d3a41efde772e6de8fb2e01f27821701.zip | |
feat(app): better diff/code comments (#14621)
Co-authored-by: adamelmore <[email protected]>
Co-authored-by: David Hill <[email protected]>
Diffstat (limited to 'packages/ui/src/components/message-part.tsx')
| -rw-r--r-- | packages/ui/src/components/message-part.tsx | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/packages/ui/src/components/message-part.tsx b/packages/ui/src/components/message-part.tsx index 0f67d683f..e877fc725 100644 --- a/packages/ui/src/components/message-part.tsx +++ b/packages/ui/src/components/message-part.tsx @@ -27,8 +27,7 @@ import { QuestionInfo, } from "@opencode-ai/sdk/v2" import { useData } from "../context" -import { useDiffComponent } from "../context/diff" -import { useCodeComponent } from "../context/code" +import { useFileComponent } from "../context/file" import { useDialog } from "../context/dialog" import { useI18n } from "../context/i18n" import { BasicTool } from "./basic-tool" @@ -1452,7 +1451,7 @@ ToolRegistry.register({ name: "edit", render(props) { const i18n = useI18n() - const diffComponent = useDiffComponent() + const fileComponent = useFileComponent() const diagnostics = createMemo(() => getDiagnostics(props.metadata.diagnostics, props.input.filePath)) const path = createMemo(() => props.metadata?.filediff?.file || props.input.filePath || "") const filename = () => getFilename(props.input.filePath ?? "") @@ -1499,7 +1498,8 @@ ToolRegistry.register({ > <div data-component="edit-content"> <Dynamic - component={diffComponent} + component={fileComponent} + mode="diff" before={{ name: props.metadata?.filediff?.file || props.input.filePath, contents: props.metadata?.filediff?.before || props.input.oldString, @@ -1523,7 +1523,7 @@ ToolRegistry.register({ name: "write", render(props) { const i18n = useI18n() - const codeComponent = useCodeComponent() + const fileComponent = useFileComponent() const diagnostics = createMemo(() => getDiagnostics(props.metadata.diagnostics, props.input.filePath)) const path = createMemo(() => props.input.filePath || "") const filename = () => getFilename(props.input.filePath ?? "") @@ -1561,7 +1561,8 @@ ToolRegistry.register({ <ToolFileAccordion path={path()}> <div data-component="write-content"> <Dynamic - component={codeComponent} + component={fileComponent} + mode="text" file={{ name: props.input.filePath, contents: props.input.content, @@ -1595,7 +1596,7 @@ ToolRegistry.register({ name: "apply_patch", render(props) { const i18n = useI18n() - const diffComponent = useDiffComponent() + const fileComponent = useFileComponent() const files = createMemo(() => (props.metadata.files ?? []) as ApplyPatchFile[]) const pending = createMemo(() => props.status === "pending" || props.status === "running") const single = createMemo(() => { @@ -1703,7 +1704,8 @@ ToolRegistry.register({ <Show when={visible()}> <div data-component="apply-patch-file-diff"> <Dynamic - component={diffComponent} + component={fileComponent} + mode="diff" before={{ name: file.filePath, contents: file.before }} after={{ name: file.movePath ?? file.filePath, contents: file.after }} /> @@ -1780,7 +1782,8 @@ ToolRegistry.register({ > <div data-component="apply-patch-file-diff"> <Dynamic - component={diffComponent} + component={fileComponent} + mode="diff" before={{ name: file().filePath, contents: file().before }} after={{ name: file().movePath ?? file().filePath, contents: file().after }} /> |
