|
1 | | -import * as vscode from 'vscode'; |
2 | | -import { JSDOM } from 'jsdom'; |
3 | 1 | import * as DOMPurify from 'dompurify'; |
| 2 | +import { JSDOM } from 'jsdom'; |
| 3 | +import * as vscode from 'vscode'; |
| 4 | + |
| 5 | +/** |
| 6 | + * View type that uniquely identifies the Mermaid chat output renderer. |
| 7 | + */ |
| 8 | +const viewType = 'vscode-samples.mermaid'; |
4 | 9 |
|
5 | 10 | /** |
6 | 11 | * Mime type used to identify Mermaid diagram data in chat output. |
@@ -46,9 +51,9 @@ export function activate(context: vscode.ExtensionContext) { |
46 | 51 | // This will be invoked with the data generated by the tools. |
47 | 52 | // It can also be invoked when rendering old Mermaid diagrams in the chat history. |
48 | 53 | context.subscriptions.push( |
49 | | - vscode.chat.registerChatOutputRenderer(mime, { |
50 | | - async renderChatOutput(data, webview, _ctx, _token) { |
51 | | - const mermaidSource = new TextDecoder().decode(data); |
| 54 | + vscode.chat.registerChatOutputRenderer(viewType, { |
| 55 | + async renderChatOutput({value}, webview, _ctx, _token) { |
| 56 | + const mermaidSource = new TextDecoder().decode(value); |
52 | 57 |
|
53 | 58 | // Set the options for the webview |
54 | 59 | const mermaidDist = vscode.Uri.joinPath(context.extensionUri, 'node_modules', 'mermaid', 'dist'); |
|
0 commit comments