feat:接入波形查看器的工具

- 生成VCD文件后,就自动打开波形查看的工具显示波形
This commit is contained in:
Roe-xin
2025-12-15 11:51:35 +08:00
parent 22b9a0ed13
commit ab6d257df2
10 changed files with 642 additions and 11 deletions

View File

@ -1,6 +1,7 @@
import * as vscode from "vscode";
import { ICViewProvider } from "./views/ICViewProvider";
import { showICHelperPanel } from "./panels/ICHelperPanel";
import { VCDViewerPanel } from "./panels/VCDViewerPanel";
export function activate(context: vscode.ExtensionContext) {
console.log("🎉 IC Coder 插件已激活!");
@ -21,6 +22,34 @@ export function activate(context: vscode.ExtensionContext) {
}
);
// 注册命令:打开 VCD 波形查看器
const openVCDViewerCommand = vscode.commands.registerCommand(
"ic-coder.openVCDViewer",
async (vcdFilePath?: string) => {
if (!vcdFilePath) {
// 如果没有提供文件路径,让用户选择 VCD 文件
const fileUri = await vscode.window.showOpenDialog({
canSelectFiles: true,
canSelectFolders: false,
canSelectMany: false,
filters: {
"VCD 文件": ["vcd"],
"所有文件": ["*"],
},
title: "选择 VCD 文件",
});
if (fileUri && fileUri[0]) {
vcdFilePath = fileUri[0].fsPath;
} else {
return;
}
}
VCDViewerPanel.createOrShow(context.extensionUri, vcdFilePath);
}
);
// 注册侧边栏视图
const viewProvider = new ICViewProvider(context.extensionUri);
const viewRegistration = vscode.window.registerWebviewViewProvider(
@ -32,6 +61,7 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(
openPanelCommand,
openChatCommand,
openVCDViewerCommand,
viewRegistration
);
}