|
|
@@ -1762,11 +1762,6 @@ function Write(props: ToolProps<typeof WriteTool>) {
|
|
|
return props.input.content
|
|
|
})
|
|
|
|
|
|
- const diagnostics = createMemo(() => {
|
|
|
- const filePath = Filesystem.normalizePath(props.input.filePath ?? "")
|
|
|
- return props.metadata.diagnostics?.[filePath] ?? []
|
|
|
- })
|
|
|
-
|
|
|
return (
|
|
|
<Switch>
|
|
|
<Match when={props.metadata.diagnostics !== undefined}>
|
|
|
@@ -1780,15 +1775,7 @@ function Write(props: ToolProps<typeof WriteTool>) {
|
|
|
content={code()}
|
|
|
/>
|
|
|
</line_number>
|
|
|
- <Show when={diagnostics().length}>
|
|
|
- <For each={diagnostics()}>
|
|
|
- {(diagnostic) => (
|
|
|
- <text fg={theme.error}>
|
|
|
- Error [{diagnostic.range.start.line}:{diagnostic.range.start.character}]: {diagnostic.message}
|
|
|
- </text>
|
|
|
- )}
|
|
|
- </For>
|
|
|
- </Show>
|
|
|
+ <Diagnostics diagnostics={props.metadata.diagnostics} filePath={props.input.filePath ?? ""} />
|
|
|
</BlockTool>
|
|
|
</Match>
|
|
|
<Match when={true}>
|
|
|
@@ -1972,12 +1959,6 @@ function Edit(props: ToolProps<typeof EditTool>) {
|
|
|
|
|
|
const diffContent = createMemo(() => props.metadata.diff)
|
|
|
|
|
|
- const diagnostics = createMemo(() => {
|
|
|
- const filePath = Filesystem.normalizePath(props.input.filePath ?? "")
|
|
|
- const arr = props.metadata.diagnostics?.[filePath] ?? []
|
|
|
- return arr.filter((x) => x.severity === 1).slice(0, 3)
|
|
|
- })
|
|
|
-
|
|
|
return (
|
|
|
<Switch>
|
|
|
<Match when={props.metadata.diff !== undefined}>
|
|
|
@@ -2003,18 +1984,7 @@ function Edit(props: ToolProps<typeof EditTool>) {
|
|
|
removedLineNumberBg={theme.diffRemovedLineNumberBg}
|
|
|
/>
|
|
|
</box>
|
|
|
- <Show when={diagnostics().length}>
|
|
|
- <box>
|
|
|
- <For each={diagnostics()}>
|
|
|
- {(diagnostic) => (
|
|
|
- <text fg={theme.error}>
|
|
|
- Error [{diagnostic.range.start.line + 1}:{diagnostic.range.start.character + 1}]{" "}
|
|
|
- {diagnostic.message}
|
|
|
- </text>
|
|
|
- )}
|
|
|
- </For>
|
|
|
- </box>
|
|
|
- </Show>
|
|
|
+ <Diagnostics diagnostics={props.metadata.diagnostics} filePath={props.input.filePath ?? ""} />
|
|
|
</BlockTool>
|
|
|
</Match>
|
|
|
<Match when={true}>
|
|
|
@@ -2086,6 +2056,7 @@ function ApplyPatch(props: ToolProps<typeof ApplyPatchTool>) {
|
|
|
}
|
|
|
>
|
|
|
<Diff diff={file.diff} filePath={file.filePath} />
|
|
|
+ <Diagnostics diagnostics={props.metadata.diagnostics} filePath={file.movePath ?? file.filePath} />
|
|
|
</Show>
|
|
|
</BlockTool>
|
|
|
)}
|
|
|
@@ -2163,6 +2134,29 @@ function Skill(props: ToolProps<typeof SkillTool>) {
|
|
|
)
|
|
|
}
|
|
|
|
|
|
+function Diagnostics(props: { diagnostics?: Record<string, Record<string, any>[]>; filePath: string }) {
|
|
|
+ const { theme } = useTheme()
|
|
|
+ const errors = createMemo(() => {
|
|
|
+ const normalized = Filesystem.normalizePath(props.filePath)
|
|
|
+ const arr = props.diagnostics?.[normalized] ?? []
|
|
|
+ return arr.filter((x) => x.severity === 1).slice(0, 3)
|
|
|
+ })
|
|
|
+
|
|
|
+ return (
|
|
|
+ <Show when={errors().length}>
|
|
|
+ <box>
|
|
|
+ <For each={errors()}>
|
|
|
+ {(diagnostic) => (
|
|
|
+ <text fg={theme.error}>
|
|
|
+ Error [{diagnostic.range.start.line + 1}:{diagnostic.range.start.character + 1}] {diagnostic.message}
|
|
|
+ </text>
|
|
|
+ )}
|
|
|
+ </For>
|
|
|
+ </box>
|
|
|
+ </Show>
|
|
|
+ )
|
|
|
+}
|
|
|
+
|
|
|
function normalizePath(input?: string) {
|
|
|
if (!input) return ""
|
|
|
if (path.isAbsolute(input)) {
|