diff --git a/resources/dide-lsp/static/xilinx/primitive.bin b/resources/dide-lsp/static/xilinx/primitive.bin index 4bd7e11..fe9c9f1 100644 Binary files a/resources/dide-lsp/static/xilinx/primitive.bin and b/resources/dide-lsp/static/xilinx/primitive.bin differ diff --git a/src/function/sim/instance.ts b/src/function/sim/instance.ts index d2cb4e3..93b2967 100644 --- a/src/function/sim/instance.ts +++ b/src/function/sim/instance.ts @@ -75,7 +75,7 @@ function instanceVhdlCode(module: HdlModule) { instContent += `generic map(\n${param})\n`; } - instContent += `port map(\n${port});\n`; + instContent += `port map(\n${port.trim()}\n);\n`; return instContent; } diff --git a/src/function/sim/simulate.ts b/src/function/sim/simulate.ts index 9e523d3..c478a78 100644 --- a/src/function/sim/simulate.ts +++ b/src/function/sim/simulate.ts @@ -207,7 +207,7 @@ class IcarusSimulate extends Simulate { continue; } // icarus 不支持 IP - if (dep.startsWith(opeParam.prjInfo.ipPath)) { + if (opeParam.prjInfo.ipPath.length > 0 && dep.startsWith(opeParam.prjInfo.ipPath)) { MainOutput.report(t('error.simluate.icarus.use-ip', dep), { level: ReportType.Error }); continue; } diff --git a/src/function/tool.ts b/src/function/tool.ts index 8746649..13fc6bd 100644 --- a/src/function/tool.ts +++ b/src/function/tool.ts @@ -156,7 +156,21 @@ function exportFilelist(view: ModuleDataItem) { deps.others.forEach(path => fileset.add(path)); deps.include.forEach(path => fileset.add(path)); const filelist = [view.path]; - filelist.push(...fileset); + + for (const dep of fileset) { + // 去除其中的原语 + if (dep === 'xilinx-primitives') { + continue; + } + + // 去除其中的 IP 文件 + if (opeParam.prjInfo.ipPath.length > 0 && dep.startsWith(opeParam.prjInfo.ipPath)) { + continue; + } + + filelist.push(dep); + } + askUserToSaveFilelist(filelist); } else { vscode.window.showErrorMessage('fail to get deps of view ' + view.name); diff --git a/src/function/treeView/tree.ts b/src/function/treeView/tree.ts index f953827..964fc27 100644 --- a/src/function/treeView/tree.ts +++ b/src/function/treeView/tree.ts @@ -10,7 +10,6 @@ import { getIconConfig } from '../../hdlFs/icons'; import { DoFastFileType } from '../../global/lsp'; import { t } from '../../i18n'; -let needExpand = true; interface ModuleDataItem { icon: string, // 图标 @@ -118,10 +117,13 @@ class ModuleTreeProvider implements vscode.TreeDataProvider { let collapsibleState; if (!expandable) { collapsibleState = vscode.TreeItemCollapsibleState.None; - } else if (needExpand) { - collapsibleState = vscode.TreeItemCollapsibleState.Expanded; - } else { - collapsibleState = vscode.TreeItemCollapsibleState.Collapsed; + } else { + // 默认只让 src 和 sim 展开 + if (element.parent === undefined) { + collapsibleState = vscode.TreeItemCollapsibleState.Expanded; + } else { + collapsibleState = vscode.TreeItemCollapsibleState.Collapsed; + } } const treeItem = new vscode.TreeItem(itemName, collapsibleState); @@ -179,7 +181,7 @@ class ModuleTreeProvider implements vscode.TreeDataProvider { const hardwarePath = opeParam.prjInfo.arch.hardware; const moduleType = element.name as keyof (SrcPath & SimPath); - const topModules = hdlParam.getTopModulesByType(moduleType); + const topModules = hdlParam.getTopModulesByType(moduleType); const topModuleItemList = topModules.map(module => ({ icon: this.judgeTopModuleIconByDoFastType(module.file.doFastType), type: moduleType, diff --git a/src/hdlParser/core.ts b/src/hdlParser/core.ts index 308bf8e..1047d40 100644 --- a/src/hdlParser/core.ts +++ b/src/hdlParser/core.ts @@ -314,7 +314,7 @@ class HdlParam { for (const p of pools) { const increment = Math.floor(p.id / fileNum * 100); await p.promise; - console.log("handle id " + p.id + ' increment: ' + increment); + // console.log("handle id " + p.id + ' increment: ' + increment); progress?.report({ message: reportTitle + ` ${p.id}/${fileNum}`, increment }); } pools.length = 0; @@ -351,7 +351,7 @@ class HdlParam { for (const p of pools) { const increment = Math.floor(p.id / fileNum * 100); await p.promise; - console.log("handle id " + p.id + ' increment: ' + increment); + // console.log("handle id " + p.id + ' increment: ' + increment); progress?.report({ message: reportTitle + ` ${p.id}/${fileNum}`, increment }); } pools.length = 0; @@ -454,14 +454,15 @@ class HdlParam { public updateFast(path: string, fast: common.Fast) { const moduleFile = this.getHdlFile(path); + if (moduleFile === undefined) { return; } - // 1. update marco directly + // 1. 更新 macro moduleFile.updateMacro(fast.macro); - // 2. update modules one by one + // 2. 增量更新所有 module const uncheckedModuleNames = new Set(); for (const name of moduleFile.getAllModuleNames()) { uncheckedModuleNames.add(name); @@ -482,7 +483,7 @@ class HdlParam { } } - // 3. delete module not visited yet + // 3. 删除没有被访问到的 module for (const moduleName of uncheckedModuleNames) { moduleFile.deleteHdlModule(moduleName); } @@ -1078,7 +1079,7 @@ export class HdlFile { hdlParam.setHdlFile(this); // make nameToModule - this.nameToModule = new Map(); + this.nameToModule = new Map(); for (const rawHdlModule of modules) { this.createHdlModule(rawHdlModule); } diff --git a/src/manager/ignore.ts b/src/manager/ignore.ts index d5e6fe9..007e1c8 100644 --- a/src/manager/ignore.ts +++ b/src/manager/ignore.ts @@ -23,6 +23,13 @@ class HdlIgnore { let relativePath = hdlPath.toPureRelativePath(hdlPath.relative(workspace, path)); for (const pattern of this.patterns) { + // 1. 如果当前 pattern 是一个文件夹,则通过包含前缀匹配 + const patternAbsPath = hdlPath.join(workspace, pattern); + if (fspath.isAbsolute(patternAbsPath) && relativePath.startsWith(pattern)) { + return true; + } + + // 2. 通过 glob 进行匹配 const matched = minimatch(relativePath, pattern); if (matched) { return true;