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);