From 0987738ed9a8fe058e3624ab6d0a1765a0dfe7cf Mon Sep 17 00:00:00 2001 From: LSTM-Kirigaya <1193466151@qq.com> Date: Mon, 23 Dec 2024 16:48:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E6=A0=91=E4=B8=AD=EF=BC=8C=E8=AE=BE=E7=BD=AE=E9=A1=B6=E5=B1=82?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/function/lsp/linter/manager.ts | 10 +++++---- src/function/treeView/tree.ts | 35 ++++++++++++++++-------------- src/manager/PL/index.ts | 4 ---- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/function/lsp/linter/manager.ts b/src/function/lsp/linter/manager.ts index 88f5539..87786b0 100644 --- a/src/function/lsp/linter/manager.ts +++ b/src/function/lsp/linter/manager.ts @@ -329,11 +329,13 @@ export async function refreshWorkspaceDiagonastics( await asyncConsumer(lintPaths, consumer, parallelChunk, progress); } else if (linterMode === LinterMode.Common) { // common, 只对打开文件进行操作 - // 先清除所有的诊断结果 - const clearConsumer = async (path: string) => { - await clearDiagnostics(client, path); + if (!isInitialise) { + // 先清除所有的诊断结果 + const clearConsumer = async (path: string) => { + await clearDiagnostics(client, path); + } + await asyncConsumer(lintPaths, clearConsumer, parallelChunk); } - await asyncConsumer(lintPaths, clearConsumer, parallelChunk); // 再对激活区域进行诊断 const consumer = async (path: string) => { diff --git a/src/function/treeView/tree.ts b/src/function/treeView/tree.ts index 967ee89..4736481 100644 --- a/src/function/treeView/tree.ts +++ b/src/function/treeView/tree.ts @@ -137,7 +137,7 @@ class ModuleTreeProvider implements vscode.TreeDataProvider { // set tooltip treeItem.tooltip = element.path; if (!treeItem.tooltip) { - treeItem.tooltip = t('info.treeview.item.tooltip'); + treeItem.tooltip = 'src'; } // set iconPath @@ -201,30 +201,33 @@ class ModuleTreeProvider implements vscode.TreeDataProvider { const type = moduleType as keyof FirstTop; // 默认选择依赖模块最多的作为 first top - let firstTop: { path: string, name: string } | undefined = undefined; - let maxDepSize = 0; + let firstTop = this.firstTop[type]; - - 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 }; + 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 }; + } + } + + if (firstTop) { + // 将当前模块设置为 first top + this.setFirstTop(type, firstTop.name, firstTop.path); } } - if (firstTop === undefined) { + if (!firstTop) { // 没有找到顶层模块,代表当前本来就是空的 // 此时 topModuleItemList 一定是 [] return topModuleItemList; } - // 将当前模块设置为 first top - this.setFirstTop(type, firstTop.name, firstTop.path); - // 将 first top 放到数据列表开头 const firstTopIcon = this.makeFirstTopIconName(type); diff --git a/src/manager/PL/index.ts b/src/manager/PL/index.ts index df243d5..eed32e0 100644 --- a/src/manager/PL/index.ts +++ b/src/manager/PL/index.ts @@ -105,10 +105,6 @@ class PlManage extends BaseManage { public setSrcTop(item: ModuleDataItem) { this.context.ope.setSrcTop(item.name, this.context); const type = moduleTreeProvider.getItemType(item); - console.log('set top'); - console.log(type); - console.log(item); - if (type === HdlFileProjectType.Src) { moduleTreeProvider.setFirstTop(HdlFileProjectType.Src, item.name, item.path);