Merge branch 'main' of https://github.com/Digital-EDA/Digital-IDE
This commit is contained in:
commit
cbb9c40940
10
package.json
10
package.json
@ -284,12 +284,12 @@
|
||||
"default": "vivado",
|
||||
"description": "%digital-ide.function.lsp.linter.vhdl.diagnostor.title%"
|
||||
},
|
||||
"digital-ide.function.lsp.linter.linter-mode": {
|
||||
"digital-ide.function.lsp.linter.mode": {
|
||||
"type": "string",
|
||||
"enumDescriptions": [
|
||||
"%digital-ide.function.lsp.linter.linter-mode.0.title%",
|
||||
"%digital-ide.function.lsp.linter.linter-mode.1.title%",
|
||||
"%digital-ide.function.lsp.linter.linter-mode.2.title%"
|
||||
"%digital-ide.function.lsp.linter.mode.0.title%",
|
||||
"%digital-ide.function.lsp.linter.mode.1.title%",
|
||||
"%digital-ide.function.lsp.linter.mode.2.title%"
|
||||
],
|
||||
"enum": [
|
||||
"full",
|
||||
@ -297,7 +297,7 @@
|
||||
"shutdown"
|
||||
],
|
||||
"default": "full",
|
||||
"description": "%digital-ide.function.lsp.linter.linter-mode.title%"
|
||||
"description": "%digital-ide.function.lsp.linter.mode.title%"
|
||||
},
|
||||
"digital-ide.function.lsp.linter.linter-level": {
|
||||
"type": "string",
|
||||
|
@ -94,10 +94,10 @@
|
||||
"digital-ide.structure.from-xilinx-to-standard.title": "Konvertieren Sie Xilinx-Projekte in die Digital IDE-Standardprojektstruktur",
|
||||
"digital-ide.prj.verible.install.path.title": "Installationsverzeichnispfad für verible, also der absolute Pfad des Ordners, der die ausführbare Datei verible-verilog-syntax enthält. Wenn nicht angegeben, wird standardmäßig verible-verilog-syntax für die Diagnose verwendet.",
|
||||
"digital-ide.prj.verilator.install.path.title": "Installationsverzeichnispfad für verilator, also der absolute Pfad des Ordners, der die ausführbare Datei verilator enthält. Wenn nicht angegeben, wird standardmäßig verilator für die Diagnose verwendet.",
|
||||
"digital-ide.function.lsp.linter.linter-mode.title": "Diagnosemodus des Linters festlegen",
|
||||
"digital-ide.function.lsp.linter.linter-mode.0.title": "Diagnostizieren Sie alle Designquellen direkt und melden Sie Fehler, unabhängig davon, ob die Dateien geöffnet sind.",
|
||||
"digital-ide.function.lsp.linter.linter-mode.1.title": "Wenn eine einzelne Datei geschlossen ist, wird der entsprechende Fehler entfernt, und nur die geöffnete Datei wird diagnostiziert.",
|
||||
"digital-ide.function.lsp.linter.linter-mode.2.title": "Global deaktiviert, d.h. für das gesamte Projekt werden keine Projektfehler gemeldet.",
|
||||
"digital-ide.function.lsp.linter.mode.title": "Diagnosemodus des Linters festlegen",
|
||||
"digital-ide.function.lsp.linter.mode.0.title": "Diagnostizieren Sie alle Designquellen direkt und melden Sie Fehler, unabhängig davon, ob die Dateien geöffnet sind.",
|
||||
"digital-ide.function.lsp.linter.mode.1.title": "Wenn eine einzelne Datei geschlossen ist, wird der entsprechende Fehler entfernt, und nur die geöffnete Datei wird diagnostiziert.",
|
||||
"digital-ide.function.lsp.linter.mode.2.title": "Global deaktiviert, d.h. für das gesamte Projekt werden keine Projektfehler gemeldet.",
|
||||
"digital-ide.function.lsp.linter.linter-level.title": "Diagnoselevel-Einstellungen des Linters",
|
||||
"digital-ide.function.lsp.linter.linter-level.error.title": "Nur Fehler anzeigen",
|
||||
"digital-ide.function.lsp.linter.linter-level.warning.title": "Fehler und Warnungen anzeigen"
|
||||
|
@ -94,10 +94,10 @@
|
||||
"digital-ide.structure.from-xilinx-to-standard.title": "Xilinx プロジェクトを Digital IDE 標準プロジェクト構造に変換する",
|
||||
"digital-ide.prj.verible.install.path.title": "verible のインストールディレクトリパス。つまり、verible-verilog-syntax 実行ファイルを含むフォルダの絶対パス。指定しない場合、デフォルトで verible-verilog-syntax が診断に使用されます。",
|
||||
"digital-ide.prj.verilator.install.path.title": "verilator のインストールディレクトリパス。つまり、verilator 実行ファイルを含むフォルダの絶対パス。指定しない場合、デフォルトで verilator が診断に使用されます。",
|
||||
"digital-ide.function.lsp.linter.linter-mode.title": "リンターの診断モードを指定",
|
||||
"digital-ide.function.lsp.linter.linter-mode.0.title": "すべての設計ソースを直接診断し、エラーを報告します。ファイルが開いているかどうかに関係なく。",
|
||||
"digital-ide.function.lsp.linter.linter-mode.1.title": "単一のファイルが閉じられた場合、対応するエラーが削除され、開いているファイルのみが診断されます。",
|
||||
"digital-ide.function.lsp.linter.linter-mode.2.title": "グローバルに無効化され、プロジェクト全体でプロジェクトエラーが報告されません。",
|
||||
"digital-ide.function.lsp.linter.mode.title": "リンターの診断モードを指定",
|
||||
"digital-ide.function.lsp.linter.mode.0.title": "すべての設計ソースを直接診断し、エラーを報告します。ファイルが開いているかどうかに関係なく。",
|
||||
"digital-ide.function.lsp.linter.mode.1.title": "単一のファイルが閉じられた場合、対応するエラーが削除され、開いているファイルのみが診断されます。",
|
||||
"digital-ide.function.lsp.linter.mode.2.title": "グローバルに無効化され、プロジェクト全体でプロジェクトエラーが報告されません。",
|
||||
"digital-ide.function.lsp.linter.linter-level.title": "診断器の診断レベル設定",
|
||||
"digital-ide.function.lsp.linter.linter-level.error.title": "エラーのみ表示",
|
||||
"digital-ide.function.lsp.linter.linter-level.warning.title": "エラーと警告を表示"
|
||||
|
@ -94,10 +94,10 @@
|
||||
"digital-ide.structure.from-xilinx-to-standard.title": "Convert Xilinx projects to Digital IDE standard project structure",
|
||||
"digital-ide.prj.verible.install.path.title": "Installation directory path for verible, which is the absolute path of the folder containing the verible-verilog-syntax executable. If not specified, verible-verilog-syntax will be used for diagnostics by default.",
|
||||
"digital-ide.prj.verilator.install.path.title": "Installation directory path for verilator, which is the absolute path of the folder containing the verilator executable. If not specified, verilator will be used for diagnostics by default.",
|
||||
"digital-ide.function.lsp.linter.linter-mode.title": "Specify the diagnostic mode of the linter",
|
||||
"digital-ide.function.lsp.linter.linter-mode.0.title": "Diagnose all design sources directly and report errors, regardless of whether the files are open.",
|
||||
"digital-ide.function.lsp.linter.linter-mode.1.title": "When a single file is closed, the corresponding error is removed, and only the file that is opened is diagnosed.",
|
||||
"digital-ide.function.lsp.linter.linter-mode.2.title": "Globally disabled, meaning no project errors are reported for the entire project.",
|
||||
"digital-ide.function.lsp.linter.mode.title": "Specify the diagnostic mode of the linter",
|
||||
"digital-ide.function.lsp.linter.mode.0.title": "Diagnose all design sources directly and report errors, regardless of whether the files are open.",
|
||||
"digital-ide.function.lsp.linter.mode.1.title": "When a single file is closed, the corresponding error is removed, and only the file that is opened is diagnosed.",
|
||||
"digital-ide.function.lsp.linter.mode.2.title": "Globally disabled, meaning no project errors are reported for the entire project.",
|
||||
"digital-ide.function.lsp.linter.linter-level.title": "Diagnostic Level Settings for the Linter",
|
||||
"digital-ide.function.lsp.linter.linter-level.error.title": "Show Only Errors",
|
||||
"digital-ide.function.lsp.linter.linter-level.warning.title": "Show Errors and Warnings"
|
||||
|
@ -94,10 +94,10 @@
|
||||
"digital-ide.structure.from-xilinx-to-standard.title": "将 Xilinx 项目转换成 Digital IDE 标准项目结构",
|
||||
"digital-ide.prj.verible.install.path.title": "verible 的安装目录路径,也就是包含 verible-verilog-syntax 可执行文件的文件夹的绝对路径。如果不指定,默认采用 verible-verilog-syntax 执行诊断。",
|
||||
"digital-ide.prj.verilator.install.path.title": "verilator 的安装目录路径,也就是包含了 verilator 可执行文件的文件夹的绝对路径。不如不指定,默认采用 verilator 执行诊断。",
|
||||
"digital-ide.function.lsp.linter.linter-mode.title": "指定诊断器的诊断模式",
|
||||
"digital-ide.function.lsp.linter.linter-mode.0.title": "将所有设计源直接进行诊断,并报错,无论文件是否打开。",
|
||||
"digital-ide.function.lsp.linter.linter-mode.1.title": "单文件关闭时,对应报错去除,打开哪个文件就对哪个文件进行诊断。",
|
||||
"digital-ide.function.lsp.linter.linter-mode.2.title": "全局关闭,即整个工程都不进行工程报错。",
|
||||
"digital-ide.function.lsp.linter.mode.title": "指定诊断器的诊断模式",
|
||||
"digital-ide.function.lsp.linter.mode.0.title": "将所有设计源直接进行诊断,并报错,无论文件是否打开。",
|
||||
"digital-ide.function.lsp.linter.mode.1.title": "单文件关闭时,对应报错去除,打开哪个文件就对哪个文件进行诊断。",
|
||||
"digital-ide.function.lsp.linter.mode.2.title": "全局关闭,即整个工程都不进行工程报错。",
|
||||
"digital-ide.function.lsp.linter.linter-level.title": "诊断器诊断等级设置",
|
||||
"digital-ide.function.lsp.linter.linter-level.error.title": "只显示错误",
|
||||
"digital-ide.function.lsp.linter.linter-level.warning.title": "显示错误和警告"
|
||||
|
@ -94,10 +94,10 @@
|
||||
"digital-ide.structure.from-xilinx-to-standard.title": "將 Xilinx 專案轉換成 Digital IDE 標準專案結構",
|
||||
"digital-ide.prj.verible.install.path.title": "verible 的安裝目錄路徑,也就是包含 verible-verilog-syntax 可執行文件的文件夾的絕對路徑。如果不指定,默認採用 verible-verilog-syntax 執行診斷。",
|
||||
"digital-ide.prj.verilator.install.path.title": "verilator 的安裝目錄路徑,也就是包含了 verilator 可執行文件的文件夾的絕對路徑。不如不指定,默認採用 verilator 執行診斷。",
|
||||
"digital-ide.function.lsp.linter.linter-mode.title": "指定診斷器的診斷模式",
|
||||
"digital-ide.function.lsp.linter.linter-mode.0.title": "將所有設計源直接進行診斷,並報錯,無論文件是否打開。",
|
||||
"digital-ide.function.lsp.linter.linter-mode.1.title": "單文件關閉時,對應報錯去除,打開哪個文件就對哪個文件進行診斷。",
|
||||
"digital-ide.function.lsp.linter.linter-mode.2.title": "全局關閉,即整個工程都不進行工程報錯。",
|
||||
"digital-ide.function.lsp.linter.mode.title": "指定診斷器的診斷模式",
|
||||
"digital-ide.function.lsp.linter.mode.0.title": "將所有設計源直接進行診斷,並報錯,無論文件是否打開。",
|
||||
"digital-ide.function.lsp.linter.mode.1.title": "單文件關閉時,對應報錯去除,打開哪個文件就對哪個文件進行診斷。",
|
||||
"digital-ide.function.lsp.linter.mode.2.title": "全局關閉,即整個工程都不進行工程報錯。",
|
||||
"digital-ide.function.lsp.linter.linter-level.title": "診斷器診斷等級設置",
|
||||
"digital-ide.function.lsp.linter.linter-level.error.title": "只顯示錯誤",
|
||||
"digital-ide.function.lsp.linter.linter-level.warning.title": "顯示錯誤和警告"
|
||||
|
Binary file not shown.
@ -581,14 +581,6 @@
|
||||
"description":"interface name; ... endinterface"
|
||||
},
|
||||
|
||||
"display":{
|
||||
"prefix":"display",
|
||||
"body":[
|
||||
"\\$display($0);"
|
||||
],
|
||||
"description":"$display(\"...\", params...)"
|
||||
},
|
||||
|
||||
"set Module":{
|
||||
"prefix":"setmodule",
|
||||
"body":[
|
||||
@ -663,22 +655,6 @@
|
||||
"description": "forever begin ... end"
|
||||
},
|
||||
|
||||
"write":{
|
||||
"prefix": "$write",
|
||||
"body": [
|
||||
"\\$write($1)"
|
||||
],
|
||||
"description": ""
|
||||
},
|
||||
|
||||
"clog2":{
|
||||
"prefix": "$clog2",
|
||||
"body": [
|
||||
"\\$clog2($1)"
|
||||
],
|
||||
"description": ""
|
||||
},
|
||||
|
||||
"signed":{
|
||||
"prefix": "$signed",
|
||||
"body": [
|
||||
@ -695,14 +671,6 @@
|
||||
"description": ""
|
||||
},
|
||||
|
||||
"random" : {
|
||||
"prefix": "$random",
|
||||
"body": [
|
||||
"\\$random($1)"
|
||||
],
|
||||
"description": ""
|
||||
},
|
||||
|
||||
"wavedrom comment": {
|
||||
"prefix" : "wavedrom",
|
||||
"body": [
|
||||
@ -712,26 +680,5 @@
|
||||
"}",
|
||||
"*/"
|
||||
]
|
||||
},
|
||||
|
||||
"dumpfile": {
|
||||
"prefix": "$dumpfile",
|
||||
"body": [
|
||||
"\\$dumpfile(\"$1\");"
|
||||
]
|
||||
},
|
||||
|
||||
"dumpvars": {
|
||||
"prefix": "$dumpvars",
|
||||
"body": [
|
||||
"\\$dumpvars;"
|
||||
]
|
||||
},
|
||||
|
||||
"finish": {
|
||||
"prefix": "$finish",
|
||||
"body": [
|
||||
"\\$finish;"
|
||||
]
|
||||
}
|
||||
}
|
@ -42,6 +42,12 @@ function getArrowSvgString(name: 'left' | 'right' | 'left-right' | 'left-dot' |
|
||||
return svgString;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 生成文档化中用于描述一个 module 的简易 diagram
|
||||
* @param params
|
||||
* @param ports
|
||||
* @returns
|
||||
*/
|
||||
function makeDiagram(params: HdlModuleParam[], ports: HdlModulePort[]): string {
|
||||
// make params block
|
||||
const diagramParamWrapper = makeDiagramParamWrapper(params);
|
||||
@ -77,8 +83,15 @@ function makeDiagramPortWrapper(ports: HdlModulePort[]): string {
|
||||
return '';
|
||||
}
|
||||
|
||||
const leftPorts = ports.filter(port => port.type === HdlModulePortType.Input || port.type === HdlModulePortType.Inout);
|
||||
const rightPorts = ports.filter(port => port.type === HdlModulePortType.Output);
|
||||
const leftPorts = ports.filter(port =>
|
||||
port.type === HdlModulePortType.Input ||
|
||||
port.type === HdlModulePortType.Inout ||
|
||||
port.type === HdlModulePortType.VhdlInput
|
||||
);
|
||||
const rightPorts = ports.filter(port =>
|
||||
port.type === HdlModulePortType.Output ||
|
||||
port.type === HdlModulePortType.VhdlOutput
|
||||
);
|
||||
|
||||
const leftDirection = makeLeftDirection(leftPorts);
|
||||
const diagramPorts = makeDiagramPorts(leftPorts, rightPorts);
|
||||
@ -107,13 +120,13 @@ function makePortArrow(port: HdlModulePort, direction: 'left' | 'right'): string
|
||||
return getArrowSvgString('left-right');
|
||||
}
|
||||
if (direction === 'left') {
|
||||
if (port.type === HdlModulePortType.Input) {
|
||||
if (port.type === HdlModulePortType.Input || port.type === HdlModulePortType.VhdlInput) {
|
||||
if (isValidWidth(port.width)) {
|
||||
return getArrowSvgString('right-dot');
|
||||
} else {
|
||||
return getArrowSvgString('right');
|
||||
}
|
||||
} else if (port.type === HdlModulePortType.Output) {
|
||||
} else if (port.type === HdlModulePortType.Output || port.type === HdlModulePortType.VhdlOutput) {
|
||||
if (isValidWidth(port.width)) {
|
||||
return getArrowSvgString('left-dot');
|
||||
} else {
|
||||
@ -121,13 +134,13 @@ function makePortArrow(port: HdlModulePort, direction: 'left' | 'right'): string
|
||||
}
|
||||
}
|
||||
} else if (direction === 'right') {
|
||||
if (port.type === HdlModulePortType.Input) {
|
||||
if (port.type === HdlModulePortType.Input || port.type === HdlModulePortType.VhdlInput) {
|
||||
if (isValidWidth(port.width)) {
|
||||
return getArrowSvgString('left-dot');
|
||||
} else {
|
||||
return getArrowSvgString('left');
|
||||
}
|
||||
} else if (port.type === HdlModulePortType.Output) {
|
||||
} else if (port.type === HdlModulePortType.Output || port.type === HdlModulePortType.VhdlOutput) {
|
||||
if (isValidWidth(port.width)) {
|
||||
return getArrowSvgString('right-dot');
|
||||
} else {
|
||||
@ -151,9 +164,9 @@ function makeLeftDirection(leftPorts: HdlModulePort[]): string {
|
||||
|
||||
function makePortName(port: HdlModulePort): string {
|
||||
let portClass = '';
|
||||
if (port.type === HdlModulePortType.Input) {
|
||||
if (port.type === HdlModulePortType.Input || port.type === HdlModulePortType.VhdlInput) {
|
||||
portClass = 'i-port-name';
|
||||
} else if (port.type === HdlModulePortType.Output) {
|
||||
} else if (port.type === HdlModulePortType.Output || port.type === HdlModulePortType.VhdlOutput) {
|
||||
portClass = 'o-port-name';
|
||||
} else {
|
||||
portClass = 'io-port-name';
|
||||
|
@ -254,6 +254,8 @@ async function getDocsFromModule(module: HdlModule): Promise<MarkdownString> {
|
||||
));
|
||||
} else {
|
||||
// 对于多文件,找出所有依赖项
|
||||
console.log(module);
|
||||
|
||||
insts = [...module.getAllDependenceInstance()];
|
||||
}
|
||||
|
||||
|
@ -130,13 +130,15 @@ export async function registerConfigurationUpdater(client: LanguageClient, packa
|
||||
}
|
||||
|
||||
// 如果诊断模式发生变化,进行一次刷新
|
||||
await vscode.window.withProgress({
|
||||
location: vscode.ProgressLocation.Window,
|
||||
title: t('info.progress.doing-diagnostic')
|
||||
}, async (progress: vscode.Progress<IProgress>, token: vscode.CancellationToken) => {
|
||||
const hdlFiles = await prjManage.getPrjHardwareFiles();
|
||||
await refreshWorkspaceDiagonastics(client, hdlFiles, false, progress);
|
||||
});
|
||||
if (event.affectsConfiguration(Linter.getLinterModeConfigurationName())) {
|
||||
await vscode.window.withProgress({
|
||||
location: vscode.ProgressLocation.Window,
|
||||
title: t('info.progress.doing-diagnostic')
|
||||
}, async (progress: vscode.Progress<IProgress>, token: vscode.CancellationToken) => {
|
||||
const hdlFiles = await prjManage.getPrjHardwareFiles();
|
||||
await refreshWorkspaceDiagonastics(client, hdlFiles, false, progress);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,10 @@ export function getLinterInstallConfigurationName(linterName: SupportLinterName)
|
||||
return `digital-ide.prj.${linterName}.install.path`;
|
||||
}
|
||||
|
||||
export function getLinterModeConfigurationName(): string {
|
||||
return 'digital-ide.function.lsp.linter.mode';
|
||||
}
|
||||
|
||||
export function getLinterInstallPath(linterName: SupportLinterName): string {
|
||||
const configuration = vscode.workspace.getConfiguration();
|
||||
const linterInstallConfigurationName = getLinterInstallConfigurationName(linterName);
|
||||
@ -116,8 +120,8 @@ export enum LinterMode {
|
||||
Shutdown = 'shutdown'
|
||||
}
|
||||
|
||||
export function getLinterMode(): LinterMode {
|
||||
return vscode.workspace.getConfiguration().get<LinterMode>('digital-ide.function.lsp.linter.linter-mode', LinterMode.Full);
|
||||
export function getLinterMode(): LinterMode {
|
||||
return vscode.workspace.getConfiguration().get<LinterMode>('digital-ide.function.lsp.linter.mode') || LinterMode.Common;
|
||||
}
|
||||
|
||||
export interface IConfigReminder {
|
||||
|
@ -1,14 +1,13 @@
|
||||
import * as vscode from 'vscode';
|
||||
import * as os from 'os';
|
||||
|
||||
import { LspClient, LinterOutput, ReportType, AbsPath, IProgress } from '../../../global';
|
||||
import { LinterOutput, ReportType, AbsPath, IProgress } from '../../../global';
|
||||
import { HdlLangID } from '../../../global/enum';
|
||||
import { hdlFile, hdlPath } from '../../../hdlFs';
|
||||
import { t } from '../../../i18n';
|
||||
import { getLinterConfigurationName, getLinterInstallConfigurationName, getLinterName, IConfigReminder, LinterItem, LinterMode, makeLinterNamePickItem, makeLinterOptions, SupportLinterName, updateLinterConfigurationName } from './common';
|
||||
import { getLinterConfigurationName, getLinterInstallConfigurationName, getLinterMode, getLinterName, IConfigReminder, LinterItem, LinterMode, makeLinterNamePickItem, makeLinterOptions, SupportLinterName, updateLinterConfigurationName } from './common';
|
||||
import { UpdateConfigurationType } from '../../../global/lsp';
|
||||
import { LanguageClient } from 'vscode-languageclient/node';
|
||||
import { toEscapePath } from '../../../hdlFs/path';
|
||||
|
||||
export class LinterManager {
|
||||
/**
|
||||
@ -318,22 +317,23 @@ export async function refreshWorkspaceDiagonastics(
|
||||
progress: vscode.Progress<IProgress>
|
||||
) {
|
||||
const parallelChunk = Math.min(os.cpus().length, 32);
|
||||
const configuration = vscode.workspace.getConfiguration();
|
||||
const linterMode = configuration.get<LinterMode>('digital-ide.function.lsp.linter.linter-mode', LinterMode.Common);
|
||||
|
||||
const linterMode = getLinterMode();
|
||||
|
||||
if (linterMode === LinterMode.Full) {
|
||||
// full,对工作区所有文件进行诊断
|
||||
const consumer = async (path: string) => {
|
||||
await publishDiagnostics(client, path);
|
||||
}
|
||||
await asyncConsumer(lintPaths, consumer, parallelChunk);
|
||||
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) => {
|
||||
@ -355,14 +355,14 @@ export async function refreshWorkspaceDiagonastics(
|
||||
return files;
|
||||
});
|
||||
|
||||
await asyncConsumer(tabArray, consumer, parallelChunk);
|
||||
await asyncConsumer(tabArray, consumer, parallelChunk, progress);
|
||||
} else {
|
||||
// shutdown, 如果是初始化阶段,什么都不需要做
|
||||
const consumer = async (path: string) => {
|
||||
await clearDiagnostics(client, path);
|
||||
};
|
||||
if (!isInitialise) {
|
||||
await asyncConsumer(lintPaths, consumer, parallelChunk);
|
||||
// shutdown, 如果是初始化阶段,什么都不需要做
|
||||
const consumer = async (path: string) => {
|
||||
await clearDiagnostics(client, path);
|
||||
};
|
||||
await asyncConsumer(lintPaths, consumer, parallelChunk, progress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ class ModuleTreeProvider implements vscode.TreeDataProvider<ModuleDataItem> {
|
||||
// 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<ModuleDataItem> {
|
||||
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);
|
||||
|
||||
|
@ -26,7 +26,9 @@ interface Range {
|
||||
enum HdlModulePortType {
|
||||
Inout = 'inout',
|
||||
Output = 'output',
|
||||
Input = 'input',
|
||||
Input = 'input',
|
||||
VhdlInput = 'in',
|
||||
VhdlOutput = 'out',
|
||||
Unknown = 'unknown'
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
@ -471,7 +476,6 @@ class HdlParam {
|
||||
|
||||
public updateFast(path: string, fast: common.Fast) {
|
||||
const moduleFile = this.getHdlFile(path);
|
||||
|
||||
if (moduleFile === undefined) {
|
||||
return;
|
||||
}
|
||||
@ -491,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);
|
||||
@ -867,8 +871,8 @@ class HdlModule {
|
||||
// 获取自身的
|
||||
for (const inst of this.nameToInstances.values()) {
|
||||
instances.add(inst);
|
||||
// 递归获取 inst 的
|
||||
if (inst.module) {
|
||||
// 递归获取 inst 的,防止无限递归
|
||||
if (inst.module && inst.module !== this) {
|
||||
for (const subInst of inst.module.getAllDependenceInstance()) {
|
||||
instances.add(subInst);
|
||||
}
|
||||
@ -890,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);
|
||||
}
|
||||
@ -909,9 +913,10 @@ class HdlModule {
|
||||
rawHdlInstance.instports,
|
||||
rawHdlInstance.range,
|
||||
this);
|
||||
|
||||
if (hdlInstance.module === undefined) {
|
||||
hdlInstance.module = 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);
|
||||
@ -1073,7 +1078,7 @@ class HdlModule {
|
||||
*/
|
||||
public solveUnhandleInstance() {
|
||||
const instances = hdlParam.getUnhandleInstancesByModuleName(this.name);
|
||||
|
||||
|
||||
for (const instance of instances) {
|
||||
const belongScopeModule = instance.parentMod;
|
||||
// 先从 unsolved 堆中删除当前的 instance
|
||||
@ -1152,8 +1157,7 @@ export class HdlFile {
|
||||
|
||||
// make nameToModule
|
||||
this.nameToModule = new Map<string, HdlModule>();
|
||||
|
||||
for (const rawHdlModule of modules) {
|
||||
for (const rawHdlModule of modules) {
|
||||
this.createHdlModule(rawHdlModule);
|
||||
}
|
||||
}
|
||||
|
@ -105,6 +105,7 @@ class PlManage extends BaseManage {
|
||||
public setSrcTop(item: ModuleDataItem) {
|
||||
this.context.ope.setSrcTop(item.name, this.context);
|
||||
const type = moduleTreeProvider.getItemType(item);
|
||||
|
||||
if (type === HdlFileProjectType.Src) {
|
||||
moduleTreeProvider.setFirstTop(HdlFileProjectType.Src, item.name, item.path);
|
||||
moduleTreeProvider.refreshSrc();
|
||||
|
Loading…
x
Reference in New Issue
Block a user