Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/mermaid-chat-features/src/extension.ts
5267 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
import * as vscode from 'vscode';
6
import { registerChatSupport } from './chatOutputRenderer';
7
import { MermaidEditorManager } from './editorManager';
8
import { MermaidWebviewManager } from './webviewManager';
9
10
11
export function activate(context: vscode.ExtensionContext) {
12
const webviewManager = new MermaidWebviewManager();
13
14
const editorManager = new MermaidEditorManager(context.extensionUri, webviewManager);
15
context.subscriptions.push(editorManager);
16
17
// Register chat support
18
context.subscriptions.push(registerChatSupport(context, webviewManager, editorManager));
19
20
// Register commands
21
context.subscriptions.push(
22
vscode.commands.registerCommand('_mermaid-chat.resetPanZoom', (ctx?: { mermaidWebviewId?: string }) => {
23
webviewManager.resetPanZoom(ctx?.mermaidWebviewId);
24
})
25
);
26
27
context.subscriptions.push(
28
vscode.commands.registerCommand('_mermaid-chat.copySource', (ctx?: { mermaidWebviewId?: string }) => {
29
const webviewInfo = ctx?.mermaidWebviewId ? webviewManager.getWebview(ctx.mermaidWebviewId) : webviewManager.activeWebview;
30
if (webviewInfo) {
31
vscode.env.clipboard.writeText(webviewInfo.mermaidSource);
32
}
33
})
34
);
35
}
36
37