From 4337a1c9a9d9734848d93072019576995c4cf550 Mon Sep 17 00:00:00 2001 From: Kirigaya <1193466151@qq.com> Date: Thu, 2 Jan 2025 23:43:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20netlist=20=E7=9A=84?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 31 ++++++++++++++----------------- src/function/index.ts | 23 +++++++++++++++++------ 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index 00ea4a0..fa6b3c4 100644 --- a/package.json +++ b/package.json @@ -626,6 +626,15 @@ "category": "Digital-IDE", "title": "%digital-ide.netlist.show.title%" }, + { + "command": "digital-ide.netlist.treeview", + "icon": { + "light": "images/svg/light/netlist.svg", + "dark": "images/svg/dark/netlist.svg" + }, + "category": "Digital-IDE", + "title": "test" + }, { "command": "digital-ide.waveviewer.show", "icon": { @@ -674,9 +683,12 @@ } }, { - "command": "digital-ide.netlist.show", + "command": "digital-ide.netlist.treeview", "group": "inline@3", - "when": "view == digital-ide-treeView-arch && viewItem == file" + "when": "view == digital-ide-treeView-arch && viewItem == file", + "args": { + "file": "${viewItem}" + } }, { "command": "digital-ide.pl.setSrcTop", @@ -711,11 +723,6 @@ "command": "digital-ide.tool.icarus.simulateFile", "group": "navigation@1" }, - { - "when": "editorLangId == verilog || editorLangId == systemverilog || editorLangId == vhdl", - "command": "digital-ide.netlist.show", - "group": "navigation@3" - }, { "when": "editorLangId == vcd || editorLangId == view", "command": "digital-ide.waveviewer.show", @@ -758,11 +765,6 @@ "command": "digital-ide.tool.icarus.simulateFile", "group": "navigation@5" }, - { - "when": "resourceLangId == verilog || resourceLangId == systemverilog || resourceLangId == vhdl", - "command": "digital-ide.netlist.show", - "group": "navigation@6" - }, { "when": "resourceLangId == vcd || resourceLangId == vcd", "command": "digital-ide.waveviewer.show", @@ -800,11 +802,6 @@ "command": "digital-ide.tool.instance", "group": "navigation@8" }, - { - "when": "resourceLangId == verilog || resourceLangId == systemverilog || resourceLangId == vhdl", - "command": "digital-ide.netlist.show", - "group": "navigation@9" - }, { "when": "resourceLangId == vcd || resourceLangId == view", "command": "digital-ide.waveviewer.show", diff --git a/src/function/index.ts b/src/function/index.ts index 5d28282..ea17fbb 100644 --- a/src/function/index.ts +++ b/src/function/index.ts @@ -131,12 +131,23 @@ function registerFSM(context: vscode.ExtensionContext) { } function registerNetlist(context: vscode.ExtensionContext) { - vscode.commands.registerCommand('digital-ide.netlist.show', (uri, moduleName) => { - if (typeof uri === 'string') { - uri = vscode.Uri.file(uri); - } - Netlist.openNetlistViewer(context, uri, moduleName); - }); + context.subscriptions.push( + vscode.commands.registerCommand('digital-ide.netlist.show', (uri, moduleName) => { + if (typeof uri === 'string') { + uri = vscode.Uri.file(uri); + } + Netlist.openNetlistViewer(context, uri, moduleName); + }) + ); + + context.subscriptions.push( + vscode.commands.registerCommand('digital-ide.netlist.treeview', (view: ModuleDataItem) => { + if (view.path && view.name) { + const uri = vscode.Uri.file(view.path); + Netlist.openNetlistViewer(context, uri, view.name); + } + }) + ); } function registerWaveViewer(context: vscode.ExtensionContext) {