Skip to content

Commit 7e80f44

Browse files
committed
improve vsclmt result formatting
1 parent c5db2ef commit 7e80f44

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/core/tools/vsclmt.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export async function useVSCLMT(
2121
arguments: removeClosingTag("arguments", toolArgs),
2222
})
2323

24-
await cline.ask("tool", partialMessage, toolUse.partial).catch(() => {})
24+
await cline.ask("tool", partialMessage, toolUse.partial).catch(() => { })
2525
return
2626
}
2727

@@ -86,7 +86,17 @@ export async function useVSCLMT(
8686

8787
// Format the result for display
8888
let resultText: string
89-
if (typeof result === "string") {
89+
if (result instanceof vscode.LanguageModelToolResult) {
90+
resultText = result.content
91+
.map(part => {
92+
if (typeof part === 'object' && part !== null && 'value' in part && typeof part.value === 'string') {
93+
// Assuming LanguageModelTextPart
94+
return part.value
95+
}
96+
return String(part)
97+
})
98+
.join('\n\n')
99+
} else if (typeof result === "string") {
90100
resultText = result
91101
} else if (result && typeof result === "object") {
92102
resultText = JSON.stringify(result, null, 2)

0 commit comments

Comments
 (0)