mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-06-13 07:10:26 +08:00
Update chat output renders api usage
For https://github.com/microsoft/vscode/pull/257898
This commit is contained in:
@ -55,6 +55,7 @@
|
||||
],
|
||||
"chatOutputRenderer": [
|
||||
{
|
||||
"viewType": "vscode-samples.mermaid",
|
||||
"mimeTypes": [
|
||||
"application/vnd.chat-output-renderer.mermaid"
|
||||
]
|
||||
|
||||
@ -1,6 +1,11 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { JSDOM } from 'jsdom';
|
||||
import * as DOMPurify from 'dompurify';
|
||||
import { JSDOM } from 'jsdom';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
/**
|
||||
* View type that uniquely identifies the Mermaid chat output renderer.
|
||||
*/
|
||||
const viewType = 'vscode-samples.mermaid';
|
||||
|
||||
/**
|
||||
* Mime type used to identify Mermaid diagram data in chat output.
|
||||
@ -46,9 +51,9 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
// This will be invoked with the data generated by the tools.
|
||||
// It can also be invoked when rendering old Mermaid diagrams in the chat history.
|
||||
context.subscriptions.push(
|
||||
vscode.chat.registerChatOutputRenderer(mime, {
|
||||
async renderChatOutput(data, webview, _ctx, _token) {
|
||||
const mermaidSource = new TextDecoder().decode(data);
|
||||
vscode.chat.registerChatOutputRenderer(viewType, {
|
||||
async renderChatOutput({value}, webview, _ctx, _token) {
|
||||
const mermaidSource = new TextDecoder().decode(value);
|
||||
|
||||
// Set the options for the webview
|
||||
const mermaidDist = vscode.Uri.joinPath(context.extensionUri, 'node_modules', 'mermaid', 'dist');
|
||||
|
||||
Reference in New Issue
Block a user