This commit is contained in:
锦恢 2024-12-30 23:15:43 +08:00
commit cbb9c40940
17 changed files with 118 additions and 140 deletions

View File

@ -284,12 +284,12 @@
"default": "vivado", "default": "vivado",
"description": "%digital-ide.function.lsp.linter.vhdl.diagnostor.title%" "description": "%digital-ide.function.lsp.linter.vhdl.diagnostor.title%"
}, },
"digital-ide.function.lsp.linter.linter-mode": { "digital-ide.function.lsp.linter.mode": {
"type": "string", "type": "string",
"enumDescriptions": [ "enumDescriptions": [
"%digital-ide.function.lsp.linter.linter-mode.0.title%", "%digital-ide.function.lsp.linter.mode.0.title%",
"%digital-ide.function.lsp.linter.linter-mode.1.title%", "%digital-ide.function.lsp.linter.mode.1.title%",
"%digital-ide.function.lsp.linter.linter-mode.2.title%" "%digital-ide.function.lsp.linter.mode.2.title%"
], ],
"enum": [ "enum": [
"full", "full",
@ -297,7 +297,7 @@
"shutdown" "shutdown"
], ],
"default": "full", "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": { "digital-ide.function.lsp.linter.linter-level": {
"type": "string", "type": "string",

View File

@ -94,10 +94,10 @@
"digital-ide.structure.from-xilinx-to-standard.title": "Konvertieren Sie Xilinx-Projekte in die Digital IDE-Standardprojektstruktur", "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.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.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.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.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.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.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.title": "Diagnoselevel-Einstellungen des Linters",
"digital-ide.function.lsp.linter.linter-level.error.title": "Nur Fehler anzeigen", "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" "digital-ide.function.lsp.linter.linter-level.warning.title": "Fehler und Warnungen anzeigen"

View File

@ -94,10 +94,10 @@
"digital-ide.structure.from-xilinx-to-standard.title": "Xilinx プロジェクトを Digital IDE 標準プロジェクト構造に変換する", "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.verible.install.path.title": "verible のインストールディレクトリパス。つまり、verible-verilog-syntax 実行ファイルを含むフォルダの絶対パス。指定しない場合、デフォルトで verible-verilog-syntax が診断に使用されます。",
"digital-ide.prj.verilator.install.path.title": "verilator のインストールディレクトリパス。つまり、verilator 実行ファイルを含むフォルダの絶対パス。指定しない場合、デフォルトで verilator が診断に使用されます。", "digital-ide.prj.verilator.install.path.title": "verilator のインストールディレクトリパス。つまり、verilator 実行ファイルを含むフォルダの絶対パス。指定しない場合、デフォルトで verilator が診断に使用されます。",
"digital-ide.function.lsp.linter.linter-mode.title": "リンターの診断モードを指定", "digital-ide.function.lsp.linter.mode.title": "リンターの診断モードを指定",
"digital-ide.function.lsp.linter.linter-mode.0.title": "すべての設計ソースを直接診断し、エラーを報告します。ファイルが開いているかどうかに関係なく。", "digital-ide.function.lsp.linter.mode.0.title": "すべての設計ソースを直接診断し、エラーを報告します。ファイルが開いているかどうかに関係なく。",
"digital-ide.function.lsp.linter.linter-mode.1.title": "単一のファイルが閉じられた場合、対応するエラーが削除され、開いているファイルのみが診断されます。", "digital-ide.function.lsp.linter.mode.1.title": "単一のファイルが閉じられた場合、対応するエラーが削除され、開いているファイルのみが診断されます。",
"digital-ide.function.lsp.linter.linter-mode.2.title": "グローバルに無効化され、プロジェクト全体でプロジェクトエラーが報告されません。", "digital-ide.function.lsp.linter.mode.2.title": "グローバルに無効化され、プロジェクト全体でプロジェクトエラーが報告されません。",
"digital-ide.function.lsp.linter.linter-level.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.error.title": "エラーのみ表示",
"digital-ide.function.lsp.linter.linter-level.warning.title": "エラーと警告を表示" "digital-ide.function.lsp.linter.linter-level.warning.title": "エラーと警告を表示"

View File

@ -94,10 +94,10 @@
"digital-ide.structure.from-xilinx-to-standard.title": "Convert Xilinx projects to Digital IDE standard project structure", "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.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.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.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.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.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.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.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.error.title": "Show Only Errors",
"digital-ide.function.lsp.linter.linter-level.warning.title": "Show Errors and Warnings" "digital-ide.function.lsp.linter.linter-level.warning.title": "Show Errors and Warnings"

View File

@ -94,10 +94,10 @@
"digital-ide.structure.from-xilinx-to-standard.title": "将 Xilinx 项目转换成 Digital IDE 标准项目结构", "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.verible.install.path.title": "verible 的安装目录路径,也就是包含 verible-verilog-syntax 可执行文件的文件夹的绝对路径。如果不指定,默认采用 verible-verilog-syntax 执行诊断。",
"digital-ide.prj.verilator.install.path.title": "verilator 的安装目录路径,也就是包含了 verilator 可执行文件的文件夹的绝对路径。不如不指定,默认采用 verilator 执行诊断。", "digital-ide.prj.verilator.install.path.title": "verilator 的安装目录路径,也就是包含了 verilator 可执行文件的文件夹的绝对路径。不如不指定,默认采用 verilator 执行诊断。",
"digital-ide.function.lsp.linter.linter-mode.title": "指定诊断器的诊断模式", "digital-ide.function.lsp.linter.mode.title": "指定诊断器的诊断模式",
"digital-ide.function.lsp.linter.linter-mode.0.title": "将所有设计源直接进行诊断,并报错,无论文件是否打开。", "digital-ide.function.lsp.linter.mode.0.title": "将所有设计源直接进行诊断,并报错,无论文件是否打开。",
"digital-ide.function.lsp.linter.linter-mode.1.title": "单文件关闭时,对应报错去除,打开哪个文件就对哪个文件进行诊断。", "digital-ide.function.lsp.linter.mode.1.title": "单文件关闭时,对应报错去除,打开哪个文件就对哪个文件进行诊断。",
"digital-ide.function.lsp.linter.linter-mode.2.title": "全局关闭,即整个工程都不进行工程报错。", "digital-ide.function.lsp.linter.mode.2.title": "全局关闭,即整个工程都不进行工程报错。",
"digital-ide.function.lsp.linter.linter-level.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.error.title": "只显示错误",
"digital-ide.function.lsp.linter.linter-level.warning.title": "显示错误和警告" "digital-ide.function.lsp.linter.linter-level.warning.title": "显示错误和警告"

View File

@ -94,10 +94,10 @@
"digital-ide.structure.from-xilinx-to-standard.title": "將 Xilinx 專案轉換成 Digital IDE 標準專案結構", "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.verible.install.path.title": "verible 的安裝目錄路徑,也就是包含 verible-verilog-syntax 可執行文件的文件夾的絕對路徑。如果不指定,默認採用 verible-verilog-syntax 執行診斷。",
"digital-ide.prj.verilator.install.path.title": "verilator 的安裝目錄路徑,也就是包含了 verilator 可執行文件的文件夾的絕對路徑。不如不指定,默認採用 verilator 執行診斷。", "digital-ide.prj.verilator.install.path.title": "verilator 的安裝目錄路徑,也就是包含了 verilator 可執行文件的文件夾的絕對路徑。不如不指定,默認採用 verilator 執行診斷。",
"digital-ide.function.lsp.linter.linter-mode.title": "指定診斷器的診斷模式", "digital-ide.function.lsp.linter.mode.title": "指定診斷器的診斷模式",
"digital-ide.function.lsp.linter.linter-mode.0.title": "將所有設計源直接進行診斷,並報錯,無論文件是否打開。", "digital-ide.function.lsp.linter.mode.0.title": "將所有設計源直接進行診斷,並報錯,無論文件是否打開。",
"digital-ide.function.lsp.linter.linter-mode.1.title": "單文件關閉時,對應報錯去除,打開哪個文件就對哪個文件進行診斷。", "digital-ide.function.lsp.linter.mode.1.title": "單文件關閉時,對應報錯去除,打開哪個文件就對哪個文件進行診斷。",
"digital-ide.function.lsp.linter.linter-mode.2.title": "全局關閉,即整個工程都不進行工程報錯。", "digital-ide.function.lsp.linter.mode.2.title": "全局關閉,即整個工程都不進行工程報錯。",
"digital-ide.function.lsp.linter.linter-level.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.error.title": "只顯示錯誤",
"digital-ide.function.lsp.linter.linter-level.warning.title": "顯示錯誤和警告" "digital-ide.function.lsp.linter.linter-level.warning.title": "顯示錯誤和警告"

View File

@ -581,14 +581,6 @@
"description":"interface name; ... endinterface" "description":"interface name; ... endinterface"
}, },
"display":{
"prefix":"display",
"body":[
"\\$display($0);"
],
"description":"$display(\"...\", params...)"
},
"set Module":{ "set Module":{
"prefix":"setmodule", "prefix":"setmodule",
"body":[ "body":[
@ -663,22 +655,6 @@
"description": "forever begin ... end" "description": "forever begin ... end"
}, },
"write":{
"prefix": "$write",
"body": [
"\\$write($1)"
],
"description": ""
},
"clog2":{
"prefix": "$clog2",
"body": [
"\\$clog2($1)"
],
"description": ""
},
"signed":{ "signed":{
"prefix": "$signed", "prefix": "$signed",
"body": [ "body": [
@ -695,14 +671,6 @@
"description": "" "description": ""
}, },
"random" : {
"prefix": "$random",
"body": [
"\\$random($1)"
],
"description": ""
},
"wavedrom comment": { "wavedrom comment": {
"prefix" : "wavedrom", "prefix" : "wavedrom",
"body": [ "body": [
@ -712,26 +680,5 @@
"}", "}",
"*/" "*/"
] ]
},
"dumpfile": {
"prefix": "$dumpfile",
"body": [
"\\$dumpfile(\"$1\");"
]
},
"dumpvars": {
"prefix": "$dumpvars",
"body": [
"\\$dumpvars;"
]
},
"finish": {
"prefix": "$finish",
"body": [
"\\$finish;"
]
} }
} }

View File

@ -42,6 +42,12 @@ function getArrowSvgString(name: 'left' | 'right' | 'left-right' | 'left-dot' |
return svgString; return svgString;
} }
/**
* @description module diagram
* @param params
* @param ports
* @returns
*/
function makeDiagram(params: HdlModuleParam[], ports: HdlModulePort[]): string { function makeDiagram(params: HdlModuleParam[], ports: HdlModulePort[]): string {
// make params block // make params block
const diagramParamWrapper = makeDiagramParamWrapper(params); const diagramParamWrapper = makeDiagramParamWrapper(params);
@ -77,8 +83,15 @@ function makeDiagramPortWrapper(ports: HdlModulePort[]): string {
return ''; return '';
} }
const leftPorts = ports.filter(port => port.type === HdlModulePortType.Input || port.type === HdlModulePortType.Inout); const leftPorts = ports.filter(port =>
const rightPorts = ports.filter(port => port.type === HdlModulePortType.Output); 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 leftDirection = makeLeftDirection(leftPorts);
const diagramPorts = makeDiagramPorts(leftPorts, rightPorts); const diagramPorts = makeDiagramPorts(leftPorts, rightPorts);
@ -107,13 +120,13 @@ function makePortArrow(port: HdlModulePort, direction: 'left' | 'right'): string
return getArrowSvgString('left-right'); return getArrowSvgString('left-right');
} }
if (direction === 'left') { if (direction === 'left') {
if (port.type === HdlModulePortType.Input) { if (port.type === HdlModulePortType.Input || port.type === HdlModulePortType.VhdlInput) {
if (isValidWidth(port.width)) { if (isValidWidth(port.width)) {
return getArrowSvgString('right-dot'); return getArrowSvgString('right-dot');
} else { } else {
return getArrowSvgString('right'); return getArrowSvgString('right');
} }
} else if (port.type === HdlModulePortType.Output) { } else if (port.type === HdlModulePortType.Output || port.type === HdlModulePortType.VhdlOutput) {
if (isValidWidth(port.width)) { if (isValidWidth(port.width)) {
return getArrowSvgString('left-dot'); return getArrowSvgString('left-dot');
} else { } else {
@ -121,13 +134,13 @@ function makePortArrow(port: HdlModulePort, direction: 'left' | 'right'): string
} }
} }
} else if (direction === 'right') { } else if (direction === 'right') {
if (port.type === HdlModulePortType.Input) { if (port.type === HdlModulePortType.Input || port.type === HdlModulePortType.VhdlInput) {
if (isValidWidth(port.width)) { if (isValidWidth(port.width)) {
return getArrowSvgString('left-dot'); return getArrowSvgString('left-dot');
} else { } else {
return getArrowSvgString('left'); return getArrowSvgString('left');
} }
} else if (port.type === HdlModulePortType.Output) { } else if (port.type === HdlModulePortType.Output || port.type === HdlModulePortType.VhdlOutput) {
if (isValidWidth(port.width)) { if (isValidWidth(port.width)) {
return getArrowSvgString('right-dot'); return getArrowSvgString('right-dot');
} else { } else {
@ -151,9 +164,9 @@ function makeLeftDirection(leftPorts: HdlModulePort[]): string {
function makePortName(port: HdlModulePort): string { function makePortName(port: HdlModulePort): string {
let portClass = ''; let portClass = '';
if (port.type === HdlModulePortType.Input) { if (port.type === HdlModulePortType.Input || port.type === HdlModulePortType.VhdlInput) {
portClass = 'i-port-name'; portClass = 'i-port-name';
} else if (port.type === HdlModulePortType.Output) { } else if (port.type === HdlModulePortType.Output || port.type === HdlModulePortType.VhdlOutput) {
portClass = 'o-port-name'; portClass = 'o-port-name';
} else { } else {
portClass = 'io-port-name'; portClass = 'io-port-name';

View File

@ -254,6 +254,8 @@ async function getDocsFromModule(module: HdlModule): Promise<MarkdownString> {
)); ));
} else { } else {
// 对于多文件,找出所有依赖项 // 对于多文件,找出所有依赖项
console.log(module);
insts = [...module.getAllDependenceInstance()]; insts = [...module.getAllDependenceInstance()];
} }

View File

@ -130,13 +130,15 @@ export async function registerConfigurationUpdater(client: LanguageClient, packa
} }
// 如果诊断模式发生变化,进行一次刷新 // 如果诊断模式发生变化,进行一次刷新
await vscode.window.withProgress({ if (event.affectsConfiguration(Linter.getLinterModeConfigurationName())) {
location: vscode.ProgressLocation.Window, await vscode.window.withProgress({
title: t('info.progress.doing-diagnostic') location: vscode.ProgressLocation.Window,
}, async (progress: vscode.Progress<IProgress>, token: vscode.CancellationToken) => { title: t('info.progress.doing-diagnostic')
const hdlFiles = await prjManage.getPrjHardwareFiles(); }, async (progress: vscode.Progress<IProgress>, token: vscode.CancellationToken) => {
await refreshWorkspaceDiagonastics(client, hdlFiles, false, progress); const hdlFiles = await prjManage.getPrjHardwareFiles();
}); await refreshWorkspaceDiagonastics(client, hdlFiles, false, progress);
});
}
}); });
} }

View File

@ -51,6 +51,10 @@ export function getLinterInstallConfigurationName(linterName: SupportLinterName)
return `digital-ide.prj.${linterName}.install.path`; return `digital-ide.prj.${linterName}.install.path`;
} }
export function getLinterModeConfigurationName(): string {
return 'digital-ide.function.lsp.linter.mode';
}
export function getLinterInstallPath(linterName: SupportLinterName): string { export function getLinterInstallPath(linterName: SupportLinterName): string {
const configuration = vscode.workspace.getConfiguration(); const configuration = vscode.workspace.getConfiguration();
const linterInstallConfigurationName = getLinterInstallConfigurationName(linterName); const linterInstallConfigurationName = getLinterInstallConfigurationName(linterName);
@ -116,8 +120,8 @@ export enum LinterMode {
Shutdown = 'shutdown' Shutdown = 'shutdown'
} }
export function getLinterMode(): LinterMode { export function getLinterMode(): LinterMode {
return vscode.workspace.getConfiguration().get<LinterMode>('digital-ide.function.lsp.linter.linter-mode', LinterMode.Full); return vscode.workspace.getConfiguration().get<LinterMode>('digital-ide.function.lsp.linter.mode') || LinterMode.Common;
} }
export interface IConfigReminder { export interface IConfigReminder {

View File

@ -1,14 +1,13 @@
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import * as os from 'os'; 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 { HdlLangID } from '../../../global/enum';
import { hdlFile, hdlPath } from '../../../hdlFs'; import { hdlFile, hdlPath } from '../../../hdlFs';
import { t } from '../../../i18n'; 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 { UpdateConfigurationType } from '../../../global/lsp';
import { LanguageClient } from 'vscode-languageclient/node'; import { LanguageClient } from 'vscode-languageclient/node';
import { toEscapePath } from '../../../hdlFs/path';
export class LinterManager { export class LinterManager {
/** /**
@ -318,22 +317,23 @@ export async function refreshWorkspaceDiagonastics(
progress: vscode.Progress<IProgress> progress: vscode.Progress<IProgress>
) { ) {
const parallelChunk = Math.min(os.cpus().length, 32); const parallelChunk = Math.min(os.cpus().length, 32);
const configuration = vscode.workspace.getConfiguration(); const linterMode = getLinterMode();
const linterMode = configuration.get<LinterMode>('digital-ide.function.lsp.linter.linter-mode', LinterMode.Common);
if (linterMode === LinterMode.Full) { if (linterMode === LinterMode.Full) {
// full对工作区所有文件进行诊断 // full对工作区所有文件进行诊断
const consumer = async (path: string) => { const consumer = async (path: string) => {
await publishDiagnostics(client, path); await publishDiagnostics(client, path);
} }
await asyncConsumer(lintPaths, consumer, parallelChunk); 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) => {
@ -355,14 +355,14 @@ export async function refreshWorkspaceDiagonastics(
return files; return files;
}); });
await asyncConsumer(tabArray, consumer, parallelChunk); await asyncConsumer(tabArray, consumer, parallelChunk, progress);
} else { } else {
// shutdown, 如果是初始化阶段,什么都不需要做
const consumer = async (path: string) => {
await clearDiagnostics(client, path);
};
if (!isInitialise) { if (!isInitialise) {
await asyncConsumer(lintPaths, consumer, parallelChunk); // shutdown, 如果是初始化阶段,什么都不需要做
const consumer = async (path: string) => {
await clearDiagnostics(client, path);
};
await asyncConsumer(lintPaths, consumer, parallelChunk, progress);
} }
} }
} }

View File

@ -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) {
for (const hdlModule of topModules) { let maxDepSize = 0;
// 此处断言是因为当前的 name 和 path 是从 topModules 中提取的 for (const hdlModule of topModules) {
// 它们对应的 hdlModule 一定存在 // 此处断言是因为当前的 name 和 path 是从 topModules 中提取的
const deps = hdlParam.getAllDependences(hdlModule.path, hdlModule.name)!; // 它们对应的 hdlModule 一定存在
const depSize = deps.include.length + deps.others.length; const deps = hdlParam.getAllDependences(hdlModule.path, hdlModule.name)!;
if (depSize > maxDepSize) { const depSize = deps.include.length + deps.others.length;
maxDepSize = depSize; if (depSize > maxDepSize) {
firstTop = { path: hdlModule.path, name: hdlModule.name }; 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 一定是 [] // 此时 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);

View File

@ -26,7 +26,9 @@ interface Range {
enum HdlModulePortType { enum HdlModulePortType {
Inout = 'inout', Inout = 'inout',
Output = 'output', Output = 'output',
Input = 'input', Input = 'input',
VhdlInput = 'in',
VhdlOutput = 'out',
Unknown = 'unknown' Unknown = 'unknown'
}; };

View File

@ -247,6 +247,11 @@ class HdlParam {
for (const inst of this.unhandleInstances) { for (const inst of this.unhandleInstances) {
if (inst.type === moduleName) { if (inst.type === moduleName) {
unsolvedInstances.push(inst); unsolvedInstances.push(inst);
} else if (inst.type.includes('(')) {
const entityName = moduleName.split('(')[0];
if (entityName === moduleName) {
unsolvedInstances.push(inst);
}
} }
} }
return unsolvedInstances; return unsolvedInstances;
@ -471,7 +476,6 @@ class HdlParam {
public updateFast(path: string, fast: common.Fast) { public updateFast(path: string, fast: common.Fast) {
const moduleFile = this.getHdlFile(path); const moduleFile = this.getHdlFile(path);
if (moduleFile === undefined) { if (moduleFile === undefined) {
return; return;
} }
@ -491,7 +495,7 @@ class HdlParam {
// match the same module, check then // match the same module, check then
const originalModule = moduleFile.getHdlModule(renderName); const originalModule = moduleFile.getHdlModule(renderName);
uncheckedModuleNames.delete(renderName); uncheckedModuleNames.delete(renderName);
originalModule?.update(rawHdlModule); originalModule?.update(rawHdlModule);
} else { } else {
// no matched, create it // no matched, create it
const newModule = moduleFile.createHdlModule(rawHdlModule); const newModule = moduleFile.createHdlModule(rawHdlModule);
@ -867,8 +871,8 @@ class HdlModule {
// 获取自身的 // 获取自身的
for (const inst of this.nameToInstances.values()) { for (const inst of this.nameToInstances.values()) {
instances.add(inst); instances.add(inst);
// 递归获取 inst 的 // 递归获取 inst 的,防止无限递归
if (inst.module) { if (inst.module && inst.module !== this) {
for (const subInst of inst.module.getAllDependenceInstance()) { for (const subInst of inst.module.getAllDependenceInstance()) {
instances.add(subInst); instances.add(subInst);
} }
@ -890,7 +894,7 @@ class HdlModule {
rawHdlInstance.instports, rawHdlInstance.instports,
rawHdlInstance.range, rawHdlInstance.range,
this); this);
if (!searchResult.path) { if (!searchResult.path || !hdlPath.exist(searchResult.path)) {
hdlParam.addUnhandleInstance(hdlInstance); hdlParam.addUnhandleInstance(hdlInstance);
this.addUnhandleInstance(hdlInstance); this.addUnhandleInstance(hdlInstance);
} }
@ -909,9 +913,10 @@ class HdlModule {
rawHdlInstance.instports, rawHdlInstance.instports,
rawHdlInstance.range, rawHdlInstance.range,
this); this);
if (hdlInstance.module === undefined) { if (!searchResult.path || !hdlPath.exist(searchResult.path)) {
hdlInstance.module = this; hdlParam.addUnhandleInstance(hdlInstance);
this.addUnhandleInstance(hdlInstance);
} }
if (this.nameToInstances) { if (this.nameToInstances) {
const key = this.makeInstanceKey(rawHdlInstance.name, rawHdlInstance.type); const key = this.makeInstanceKey(rawHdlInstance.name, rawHdlInstance.type);
@ -1073,7 +1078,7 @@ class HdlModule {
*/ */
public solveUnhandleInstance() { public solveUnhandleInstance() {
const instances = hdlParam.getUnhandleInstancesByModuleName(this.name); const instances = hdlParam.getUnhandleInstancesByModuleName(this.name);
for (const instance of instances) { for (const instance of instances) {
const belongScopeModule = instance.parentMod; const belongScopeModule = instance.parentMod;
// 先从 unsolved 堆中删除当前的 instance // 先从 unsolved 堆中删除当前的 instance
@ -1152,8 +1157,7 @@ export class HdlFile {
// make nameToModule // make nameToModule
this.nameToModule = new Map<string, HdlModule>(); this.nameToModule = new Map<string, HdlModule>();
for (const rawHdlModule of modules) {
for (const rawHdlModule of modules) {
this.createHdlModule(rawHdlModule); this.createHdlModule(rawHdlModule);
} }
} }

View File

@ -105,6 +105,7 @@ 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);
if (type === HdlFileProjectType.Src) { if (type === HdlFileProjectType.Src) {
moduleTreeProvider.setFirstTop(HdlFileProjectType.Src, item.name, item.path); moduleTreeProvider.setFirstTop(HdlFileProjectType.Src, item.name, item.path);
moduleTreeProvider.refreshSrc(); moduleTreeProvider.refreshSrc();