修复 endmodule 后面的 inlay hints 在结尾处的异常

This commit is contained in:
锦恢 2024-12-23 22:03:22 +08:00
parent c26bd9316e
commit b5671ae752

View File

@ -247,6 +247,11 @@ class HdlParam {
for (const inst of this.unhandleInstances) {
if (inst.type === moduleName) {
unsolvedInstances.push(inst);
} else if (inst.type.includes('(')) {
const entityName = moduleName.split('(')[0];
if (entityName === moduleName) {
unsolvedInstances.push(inst);
}
}
}
return unsolvedInstances;
@ -490,7 +495,7 @@ class HdlParam {
// match the same module, check then
const originalModule = moduleFile.getHdlModule(renderName);
uncheckedModuleNames.delete(renderName);
originalModule?.update(rawHdlModule);
originalModule?.update(rawHdlModule);
} else {
// no matched, create it
const newModule = moduleFile.createHdlModule(rawHdlModule);
@ -889,7 +894,7 @@ class HdlModule {
rawHdlInstance.instports,
rawHdlInstance.range,
this);
if (!searchResult.path) {
if (!searchResult.path || !hdlPath.exist(searchResult.path)) {
hdlParam.addUnhandleInstance(hdlInstance);
this.addUnhandleInstance(hdlInstance);
}
@ -908,7 +913,11 @@ class HdlModule {
rawHdlInstance.instports,
rawHdlInstance.range,
this);
if (!searchResult.path || !hdlPath.exist(searchResult.path)) {
hdlParam.addUnhandleInstance(hdlInstance);
this.addUnhandleInstance(hdlInstance);
}
if (this.nameToInstances) {
const key = this.makeInstanceKey(rawHdlInstance.name, rawHdlInstance.type);
this.nameToInstances.set(key, hdlInstance);
@ -1069,7 +1078,7 @@ class HdlModule {
*/
public solveUnhandleInstance() {
const instances = hdlParam.getUnhandleInstancesByModuleName(this.name);
for (const instance of instances) {
const belongScopeModule = instance.parentMod;
// 先从 unsolved 堆中删除当前的 instance