From fa9e97be8202d9477728a2ea23f7540e4fd80d1e Mon Sep 17 00:00:00 2001 From: LSTM-Kirigaya <1193466151@qq.com> Date: Sun, 1 Dec 2024 19:36:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=A8=A1=E5=9D=97=E6=A0=91?= =?UTF-8?q?=E4=B8=AD=20vhdl=20=E5=BC=95=E7=94=A8=20vlog=20=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E6=B8=B2=E6=9F=93=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/function/treeView/tree.ts | 5 +++-- src/hdlParser/core.ts | 12 ++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/function/treeView/tree.ts b/src/function/treeView/tree.ts index cedf004..f953827 100644 --- a/src/function/treeView/tree.ts +++ b/src/function/treeView/tree.ts @@ -154,6 +154,7 @@ class ModuleTreeProvider implements vscode.TreeDataProvider { public getChildren(element?: ModuleDataItem | undefined): vscode.ProviderResult { if (element) { const name = element.name; + if (name === 'sim' || name === 'src') { element.parent = undefined; return this.getTopModuleItemList(element); @@ -242,9 +243,9 @@ class ModuleTreeProvider implements vscode.TreeDataProvider { const moduleDataItemList: ModuleDataItem[] = []; const targetModule = hdlParam.getHdlModule(element.path, element.name); - + if (targetModule) { - const allInstances = targetModule.getAllInstances(); + const allInstances = targetModule.getAllInstances(); // 根据出现次序进行排序 allInstances.sort((a, b) => a.range.start.line - b.range.start.line); for (const instance of allInstances) { diff --git a/src/hdlParser/core.ts b/src/hdlParser/core.ts index d5b5f86..308bf8e 100644 --- a/src/hdlParser/core.ts +++ b/src/hdlParser/core.ts @@ -808,7 +808,7 @@ class HdlModule { const instModName = rawHdlInstance.type; if (this.languageId === HdlLangID.Verilog || this.languageId === HdlLangID.SystemVerilog) { - const searchResult = this.searchInstModPath(instModName); + const searchResult = this.searchInstModPath(instModName); const hdlInstance = new HdlInstance(rawHdlInstance.name, rawHdlInstance.type, searchResult.path, @@ -827,15 +827,19 @@ class HdlModule { } return hdlInstance; } else if (this.languageId === HdlLangID.Vhdl) { + const searchResult = this.searchInstModPath(instModName); const hdlInstance = new HdlInstance(rawHdlInstance.name, rawHdlInstance.type, - this.path, - common.InstModPathStatus.Current, + searchResult.path, + searchResult.status, rawHdlInstance.instparams, rawHdlInstance.instports, rawHdlInstance.range, this); - hdlInstance.module = this; + + if (hdlInstance.module === undefined) { + hdlInstance.module = this; + } if (this.nameToInstances) { const key = this.makeInstanceKey(rawHdlInstance.name, rawHdlInstance.type); this.nameToInstances.set(key, hdlInstance);