修复 结构树中,设置顶层模块失效
This commit is contained in:
parent
e65b531da3
commit
0987738ed9
@ -329,11 +329,13 @@ export async function refreshWorkspaceDiagonastics(
|
|||||||
await asyncConsumer(lintPaths, consumer, parallelChunk, progress);
|
await asyncConsumer(lintPaths, consumer, parallelChunk, progress);
|
||||||
} else if (linterMode === LinterMode.Common) {
|
} else if (linterMode === LinterMode.Common) {
|
||||||
// common, 只对打开文件进行操作
|
// common, 只对打开文件进行操作
|
||||||
// 先清除所有的诊断结果
|
if (!isInitialise) {
|
||||||
const clearConsumer = async (path: string) => {
|
// 先清除所有的诊断结果
|
||||||
await clearDiagnostics(client, path);
|
const clearConsumer = async (path: string) => {
|
||||||
|
await clearDiagnostics(client, path);
|
||||||
|
}
|
||||||
|
await asyncConsumer(lintPaths, clearConsumer, parallelChunk);
|
||||||
}
|
}
|
||||||
await asyncConsumer(lintPaths, clearConsumer, parallelChunk);
|
|
||||||
|
|
||||||
// 再对激活区域进行诊断
|
// 再对激活区域进行诊断
|
||||||
const consumer = async (path: string) => {
|
const consumer = async (path: string) => {
|
||||||
|
@ -137,7 +137,7 @@ class ModuleTreeProvider implements vscode.TreeDataProvider<ModuleDataItem> {
|
|||||||
// set tooltip
|
// set tooltip
|
||||||
treeItem.tooltip = element.path;
|
treeItem.tooltip = element.path;
|
||||||
if (!treeItem.tooltip) {
|
if (!treeItem.tooltip) {
|
||||||
treeItem.tooltip = t('info.treeview.item.tooltip');
|
treeItem.tooltip = 'src';
|
||||||
}
|
}
|
||||||
|
|
||||||
// set iconPath
|
// set iconPath
|
||||||
@ -201,30 +201,33 @@ class ModuleTreeProvider implements vscode.TreeDataProvider<ModuleDataItem> {
|
|||||||
const type = moduleType as keyof FirstTop;
|
const type = moduleType as keyof FirstTop;
|
||||||
|
|
||||||
// 默认选择依赖模块最多的作为 first top
|
// 默认选择依赖模块最多的作为 first top
|
||||||
let firstTop: { path: string, name: string } | undefined = undefined;
|
let firstTop = this.firstTop[type];
|
||||||
let maxDepSize = 0;
|
|
||||||
|
|
||||||
|
if (!firstTop) {
|
||||||
|
let maxDepSize = 0;
|
||||||
|
for (const hdlModule of topModules) {
|
||||||
|
// 此处断言是因为当前的 name 和 path 是从 topModules 中提取的
|
||||||
|
// 它们对应的 hdlModule 一定存在
|
||||||
|
const deps = hdlParam.getAllDependences(hdlModule.path, hdlModule.name)!;
|
||||||
|
const depSize = deps.include.length + deps.others.length;
|
||||||
|
if (depSize > maxDepSize) {
|
||||||
|
maxDepSize = depSize;
|
||||||
|
firstTop = { path: hdlModule.path, name: hdlModule.name };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (const hdlModule of topModules) {
|
if (firstTop) {
|
||||||
// 此处断言是因为当前的 name 和 path 是从 topModules 中提取的
|
// 将当前模块设置为 first top
|
||||||
// 它们对应的 hdlModule 一定存在
|
this.setFirstTop(type, firstTop.name, firstTop.path);
|
||||||
const deps = hdlParam.getAllDependences(hdlModule.path, hdlModule.name)!;
|
|
||||||
const depSize = deps.include.length + deps.others.length;
|
|
||||||
if (depSize > maxDepSize) {
|
|
||||||
maxDepSize = depSize;
|
|
||||||
firstTop = { path: hdlModule.path, name: hdlModule.name };
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (firstTop === undefined) {
|
if (!firstTop) {
|
||||||
// 没有找到顶层模块,代表当前本来就是空的
|
// 没有找到顶层模块,代表当前本来就是空的
|
||||||
// 此时 topModuleItemList 一定是 []
|
// 此时 topModuleItemList 一定是 []
|
||||||
return topModuleItemList;
|
return topModuleItemList;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 将当前模块设置为 first top
|
|
||||||
this.setFirstTop(type, firstTop.name, firstTop.path);
|
|
||||||
|
|
||||||
// 将 first top 放到数据列表开头
|
// 将 first top 放到数据列表开头
|
||||||
const firstTopIcon = this.makeFirstTopIconName(type);
|
const firstTopIcon = this.makeFirstTopIconName(type);
|
||||||
|
|
||||||
|
@ -105,10 +105,6 @@ class PlManage extends BaseManage {
|
|||||||
public setSrcTop(item: ModuleDataItem) {
|
public setSrcTop(item: ModuleDataItem) {
|
||||||
this.context.ope.setSrcTop(item.name, this.context);
|
this.context.ope.setSrcTop(item.name, this.context);
|
||||||
const type = moduleTreeProvider.getItemType(item);
|
const type = moduleTreeProvider.getItemType(item);
|
||||||
console.log('set top');
|
|
||||||
console.log(type);
|
|
||||||
console.log(item);
|
|
||||||
|
|
||||||
|
|
||||||
if (type === HdlFileProjectType.Src) {
|
if (type === HdlFileProjectType.Src) {
|
||||||
moduleTreeProvider.setFirstTop(HdlFileProjectType.Src, item.name, item.path);
|
moduleTreeProvider.setFirstTop(HdlFileProjectType.Src, item.name, item.path);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user