diff --git a/src/extension.ts b/src/extension.ts index e536ed7..e23624e 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -42,7 +42,9 @@ async function launch(context: vscode.ExtensionContext) { console.log(t('info.welcome.join-qq-group') + ' https://qm.qq.com/q/1M655h3GsA'); const packageJson = readPackageJson(context); - MainOutput.report(t('info.launch.digital-ide-current-version') + packageJson.version, ReportType.Launch); + MainOutput.report(t('info.launch.digital-ide-current-version') + packageJson.version, { + level: ReportType.Launch + }); if (packageJson === undefined) { return; diff --git a/src/function/hdlDoc/common.ts b/src/function/hdlDoc/common.ts index a1a2119..3fc0657 100644 --- a/src/function/hdlDoc/common.ts +++ b/src/function/hdlDoc/common.ts @@ -300,8 +300,12 @@ function parseJson5(text: string): any { try { json = JSON5.parse(text); } catch (error) { - MainOutput.report('error happen when parse json ', ReportType.Error); - MainOutput.report(error, ReportType.Error); + MainOutput.report('error happen when parse json ', { + level: ReportType.Error + }); + MainOutput.report(error, { + level: ReportType.Error + }); } return json; } @@ -317,8 +321,12 @@ function makeWaveDromSVG(wavedromComment: string, style: ThemeType): string { Count.svgMakeTimes += 1; return svgString; } catch (error) { - MainOutput.report('error happen when render ' + wavedromComment, ReportType.Error); - MainOutput.report(error, ReportType.Error); + MainOutput.report('error happen when render ' + wavedromComment, { + level: ReportType.Error + }); + MainOutput.report(error, { + level: ReportType.Error + }); return ''; } } diff --git a/src/function/hdlDoc/pdf.ts b/src/function/hdlDoc/pdf.ts index 69b2a17..e027119 100644 --- a/src/function/hdlDoc/pdf.ts +++ b/src/function/hdlDoc/pdf.ts @@ -104,7 +104,9 @@ async function exportCurrentFileDocAsPDF(uri: vscode.Uri) { vscode.window.showInformationMessage('pdf generated at ' + pdfPath); } catch (error) { - MainOutput.report("error happen in export pdf: " + error, ReportType.Error); + MainOutput.report("error happen in export pdf: " + error, { + level: ReportType.Error + }); } }); } diff --git a/src/function/lsp/hover/vlog.ts b/src/function/lsp/hover/vlog.ts index 612253c..a1a1299 100644 --- a/src/function/lsp/hover/vlog.ts +++ b/src/function/lsp/hover/vlog.ts @@ -148,7 +148,7 @@ import { HdlLangID } from '../../../global/enum'; // const paramResult = util.matchParams(targetWord, currentModule); // if (paramResult) { -// LspOutput.report(' get param info ' + paramResult?.name, ReportType.Info); +// LspOutput.report(' get param info ' + paramResult?.name; // const paramComment = await util.searchCommentAround(filePath, paramResult.range); // const paramDesc = util.makeParamDesc(paramResult); // content.appendCodeblock(paramDesc, HdlLangID.Verilog); @@ -162,7 +162,7 @@ import { HdlLangID } from '../../../global/enum'; // const portResult = util.matchPorts(targetWord, currentModule); // if (portResult) { -// LspOutput.report(' get port info ' + portResult?.name, ReportType.Info); +// LspOutput.report(' get port info ' + portResult?.name; // const portComment = await util.searchCommentAround(filePath, portResult.range); // const portDesc = util.makePortDesc(portResult); diff --git a/src/function/lsp/linter/modelsim.ts b/src/function/lsp/linter/modelsim.ts index 6156623..91cfb8f 100644 --- a/src/function/lsp/linter/modelsim.ts +++ b/src/function/lsp/linter/modelsim.ts @@ -50,7 +50,10 @@ class ModelsimLinter implements BaseLinter { this.diagnostic.set(document.uri, diagnostics); } } else { - LspOutput.report('modelsim linter is not available, please check prj.modelsim.install.path in your setting!', ReportType.Error, true); + LspOutput.report('modelsim linter is not available, please check prj.modelsim.install.path in your setting!', { + level: ReportType.Error, + notify: true + }); } } @@ -72,7 +75,9 @@ class ModelsimLinter implements BaseLinter { if (headerInfo === 'Error') { const errorLine = parseInt(tokens[2]) - 1; const syntaxInfo = tokens[5]; - LspOutput.report(` line: ${errorLine}, info: ${syntaxInfo}`, ReportType.Run); + LspOutput.report(` line: ${errorLine}, info: ${syntaxInfo}`, { + level: ReportType.Run + }); const range = this.makeCorrectRange(document, errorLine, syntaxInfo); const diag = new vscode.Diagnostic(range, syntaxInfo, vscode.DiagnosticSeverity.Error); @@ -80,7 +85,9 @@ class ModelsimLinter implements BaseLinter { } else if (headerInfo === 'Warning') { const errorLine = parseInt(tokens[2]) - 1; const syntaxInfo = tokens[5]; - LspOutput.report(` line: ${errorLine}, info: ${syntaxInfo}`, ReportType.Run); + LspOutput.report(` line: ${errorLine}, info: ${syntaxInfo}`, { + level: ReportType.Run + }); const range = this.makeCorrectRange(document, errorLine, syntaxInfo); const diag = new vscode.Diagnostic(range, syntaxInfo, vscode.DiagnosticSeverity.Warning); @@ -137,8 +144,12 @@ class ModelsimLinter implements BaseLinter { const fullExecutorName = opeParam.os === 'win32' ? executorName + '.exe' : executorName; if (modelsimInstallPath.trim() === '' || !fs.existsSync(modelsimInstallPath)) { - LspOutput.report(`User's modelsim Install Path "${modelsimInstallPath}", which is invalid. Use ${executorName} in default.`, ReportType.Warn); - LspOutput.report('If you have doubts, check prj.modelsim.install.path in setting', ReportType.Warn); + LspOutput.report(`User's modelsim Install Path "${modelsimInstallPath}", which is invalid. Use ${executorName} in default.`, { + level: ReportType.Warn + }); + LspOutput.report('If you have doubts, check prj.modelsim.install.path in setting', { + level: ReportType.Warn + }); return executorName; } else { LspOutput.report(`User's modelsim Install Path "${modelsimInstallPath}", which is invalid`); @@ -162,11 +173,16 @@ class ModelsimLinter implements BaseLinter { const { stderr } = await easyExec(executorPath, []); if (stderr.length === 0) { this.executableInvokeNameMap.set(langID, executorPath); - LspOutput.report(`success to verify ${executorPath}, linter from modelsim is ready to go!`, ReportType.Launch); + LspOutput.report(`success to verify ${executorPath}, linter from modelsim is ready to go!`, { + level: ReportType.Launch + }); return true; } else { this.executableInvokeNameMap.set(langID, undefined); - LspOutput.report(`Fail to execute ${executorPath}! Reason: ${stderr}`, ReportType.Error, true); + LspOutput.report(`Fail to execute ${executorPath}! Reason: ${stderr}`, { + level: ReportType.Error, + notify: true + }); return false; } } diff --git a/src/function/lsp/linter/svlog.ts b/src/function/lsp/linter/svlog.ts index b2dc942..4ff1307 100644 --- a/src/function/lsp/linter/svlog.ts +++ b/src/function/lsp/linter/svlog.ts @@ -56,7 +56,9 @@ class SvlogLinterManager implements BaseManager { await this.lint(doc); } } - LspOutput.report(' finish initialization of svlog linter. Linter name: ' + this.activateLinterName, ReportType.Launch); + LspOutput.report(' finish initialization of svlog linter. Linter name: ' + this.activateLinterName, { + level: ReportType.Launch + }); // hide it if current window is not verilog const editor = vscode.window.activeTextEditor; @@ -92,7 +94,9 @@ class SvlogLinterManager implements BaseManager { // no need for update return true; } - LspOutput.report(` detect linter setting changes, switch from ${lastDiagnostorName} to ${diagnostorName}.`, ReportType.Launch); + LspOutput.report(` detect linter setting changes, switch from ${lastDiagnostorName} to ${diagnostorName}.`, { + level: ReportType.Launch + }); let launch = false; switch (diagnostorName) { @@ -121,13 +125,15 @@ class SvlogLinterManager implements BaseManager { if (launch) { this.statusBarItem.text = '$(getting-started-beginner) Linter(vivado)'; - LspOutput.report(' vivado linter has been activated', ReportType.Info); + LspOutput.report(' vivado linter has been activated'); } else { this.statusBarItem.backgroundColor = new vscode.ThemeColor('statusBarItem.warningBackground'); this.statusBarItem.tooltip = 'Fail to launch vivado linter'; this.statusBarItem.text = '$(extensions-warning-message) Linter(vivado)'; - LspOutput.report(' Fail to launch vivado linter', ReportType.Error); + LspOutput.report(' Fail to launch vivado linter', { + level: ReportType.Error + }); } this.currentLinter = selectedLinter; @@ -145,13 +151,15 @@ class SvlogLinterManager implements BaseManager { if (launch) { this.statusBarItem.text = '$(getting-started-beginner) Linter(modelsim)'; - LspOutput.report(' modelsim linter has been activated', ReportType.Info); + LspOutput.report(' modelsim linter has been activated'); } else { this.statusBarItem.backgroundColor = new vscode.ThemeColor('statusBarItem.warningBackground'); this.statusBarItem.tooltip = 'Fail to launch modelsim linter'; this.statusBarItem.text = '$(extensions-warning-message) Linter(modelsim)'; - LspOutput.report(' Fail to launch modelsim linter', ReportType.Error); + LspOutput.report(' Fail to launch modelsim linter', { + level: ReportType.Error + }); } this.currentLinter = selectedLinter; @@ -168,13 +176,15 @@ class SvlogLinterManager implements BaseManager { if (launch) { this.statusBarItem.text = '$(getting-started-beginner) Linter(default)'; - LspOutput.report(' default build-in linter has been activated', ReportType.Info); + LspOutput.report(' default build-in linter has been activated'); } else { this.statusBarItem.backgroundColor = undefined; this.statusBarItem.tooltip = 'Fail to launch default linter'; this.statusBarItem.text = '$(extensions-warning-message) Linter(default)'; - LspOutput.report(' Fail to launch default linter', ReportType.Error); + LspOutput.report(' Fail to launch default linter', { + level: ReportType.Error + }); } this.currentLinter = selectedLinter; diff --git a/src/function/lsp/linter/verilator.ts b/src/function/lsp/linter/verilator.ts index 917faac..84a32eb 100644 --- a/src/function/lsp/linter/verilator.ts +++ b/src/function/lsp/linter/verilator.ts @@ -50,7 +50,10 @@ class VerilatorLinter implements BaseLinter { this.diagnostic.set(document.uri, diagnostics); } } else { - LspOutput.report('verilator linter is not available, please check prj.verilator.install.path in your setting', ReportType.Error, true); + LspOutput.report('verilator linter is not available, please check prj.verilator.install.path in your setting', { + level: ReportType.Error, + notify: true + }); } } @@ -118,8 +121,12 @@ class VerilatorLinter implements BaseLinter { const fullExecutorName = opeParam.os === 'win32' ? executorName + '.exe' : executorName; if (verilatorInstallPath.trim() === '' || !fs.existsSync(verilatorInstallPath)) { - LspOutput.report(`User's verilator Install Path ${verilatorInstallPath}, which is invalid. Use ${executorName} in default.`, ReportType.Warn); - LspOutput.report('If you have doubts, check prj.verilator.install.path in setting', ReportType.Warn); + LspOutput.report(`User's verilator Install Path ${verilatorInstallPath}, which is invalid. Use ${executorName} in default.`, { + level: ReportType.Warn + }); + LspOutput.report('If you have doubts, check prj.verilator.install.path in setting', { + level: ReportType.Warn + }); return executorName; } else { LspOutput.report(`User's verilator Install Path ${verilatorInstallPath}, which is invalid`); @@ -143,13 +150,18 @@ class VerilatorLinter implements BaseLinter { const { stderr } = await easyExec(executorPath, []); if (stderr.length === 0) { this.executableInvokeNameMap.set(langID, executorPath); - LspOutput.report(`success to verify ${executorPath}, linter from verilator is ready to go!`, ReportType.Launch); + LspOutput.report(`success to verify ${executorPath}, linter from verilator is ready to go!`, { + level: ReportType.Launch + }); return true; } else { this.executableInvokeNameMap.set(langID, undefined); console.log(stderr); - LspOutput.report(`Fail to execute ${executorPath}! Reason: ${stderr}`, ReportType.Error, true); + LspOutput.report(`Fail to execute ${executorPath}! Reason: ${stderr}`, { + level: ReportType.Error, + notify: true + }); return false; } diff --git a/src/function/lsp/linter/vhdl.ts b/src/function/lsp/linter/vhdl.ts index 05d886c..612a2b5 100644 --- a/src/function/lsp/linter/vhdl.ts +++ b/src/function/lsp/linter/vhdl.ts @@ -56,7 +56,9 @@ class VhdlLinterManager implements BaseManager { await this.lint(doc); } } - LspOutput.report(' finish initialization of vhdl linter. Linter name: ' + this.activateLinterName, ReportType.Launch); + LspOutput.report(' finish initialization of vhdl linter. Linter name: ' + this.activateLinterName, { + level: ReportType.Launch + }); // hide it if current window is not vhdl const editor = vscode.window.activeTextEditor; @@ -92,7 +94,9 @@ class VhdlLinterManager implements BaseManager { // no need for update return true; } - LspOutput.report(` detect linter setting changes, switch from ${lastDiagnostorName} to ${diagnostorName}.`, ReportType.Launch); + LspOutput.report(` detect linter setting changes, switch from ${lastDiagnostorName} to ${diagnostorName}.`, { + level: ReportType.Launch + }); let launch = false; switch (diagnostorName) { @@ -121,13 +125,15 @@ class VhdlLinterManager implements BaseManager { if (launch) { this.statusBarItem.text = '$(getting-started-beginner) Linter(vivado)'; - LspOutput.report(' vivado linter has been activated', ReportType.Info); + LspOutput.report(' vivado linter has been activated'); } else { this.statusBarItem.backgroundColor = new vscode.ThemeColor('statusBarItem.warningBackground'); this.statusBarItem.tooltip = 'Fail to launch vivado linter'; this.statusBarItem.text = '$(extensions-warning-message) Linter(vivado)'; - LspOutput.report(' Fail to launch vivado linter', ReportType.Error); + LspOutput.report(' Fail to launch vivado linter', { + level: ReportType.Error + }); } this.currentLinter = selectedLinter; @@ -145,13 +151,15 @@ class VhdlLinterManager implements BaseManager { if (launch) { this.statusBarItem.text = '$(getting-started-beginner) Linter(modelsim)'; - LspOutput.report(' modelsim linter has been activated', ReportType.Info); + LspOutput.report(' modelsim linter has been activated'); } else { this.statusBarItem.backgroundColor = new vscode.ThemeColor('statusBarItem.warningBackground'); this.statusBarItem.tooltip = 'Fail to launch modelsim linter'; this.statusBarItem.text = '$(extensions-warning-message) Linter(modelsim)'; - LspOutput.report(' Fail to launch modelsim linter', ReportType.Error); + LspOutput.report(' Fail to launch modelsim linter', { + level: ReportType.Error + }); } this.currentLinter = selectedLinter; @@ -168,13 +176,15 @@ class VhdlLinterManager implements BaseManager { if (launch) { this.statusBarItem.text = '$(getting-started-beginner) Linter(default)'; - LspOutput.report(' default build-in linter has been activated', ReportType.Info); + LspOutput.report(' default build-in linter has been activated'); } else { this.statusBarItem.backgroundColor = undefined; this.statusBarItem.tooltip = 'Fail to launch default linter'; this.statusBarItem.text = '$(extensions-warning-message) Linter(default)'; - LspOutput.report(' Fail to launch default linter', ReportType.Error); + LspOutput.report(' Fail to launch default linter', { + level: ReportType.Error + }); } this.currentLinter = selectedLinter; diff --git a/src/function/lsp/linter/vlog.ts b/src/function/lsp/linter/vlog.ts index 66a18d7..18500cb 100644 --- a/src/function/lsp/linter/vlog.ts +++ b/src/function/lsp/linter/vlog.ts @@ -56,7 +56,9 @@ class VlogLinterManager implements BaseManager { await this.lint(doc); } } - LspOutput.report(' finish initialization of vlog linter. Linter name: ' + this.activateLinterName, ReportType.Launch); + LspOutput.report(' finish initialization of vlog linter. Linter name: ' + this.activateLinterName, { + level: ReportType.Launch + }); // hide it if current window is not verilog const editor = vscode.window.activeTextEditor; @@ -92,7 +94,9 @@ class VlogLinterManager implements BaseManager { // no need for update return true; } - LspOutput.report(` detect linter setting changes, switch from ${lastDiagnostorName} to ${diagnostorName}.`, ReportType.Launch); + LspOutput.report(` detect linter setting changes, switch from ${lastDiagnostorName} to ${diagnostorName}.`, { + level: ReportType.Launch + }); let launch = false; switch (diagnostorName) { @@ -121,13 +125,15 @@ class VlogLinterManager implements BaseManager { if (launch) { this.statusBarItem.text = '$(getting-started-beginner) Linter(vivado)'; - LspOutput.report(' vivado linter has been activated', ReportType.Info); + LspOutput.report(' vivado linter has been activated'); } else { this.statusBarItem.backgroundColor = new vscode.ThemeColor('statusBarItem.warningBackground'); this.statusBarItem.tooltip = 'Fail to launch vivado linter'; this.statusBarItem.text = '$(extensions-warning-message) Linter(vivado)'; - LspOutput.report(' Fail to launch vivado linter', ReportType.Error); + LspOutput.report(' Fail to launch vivado linter', { + level: ReportType.Error + }); } this.currentLinter = selectedLinter; @@ -145,13 +151,15 @@ class VlogLinterManager implements BaseManager { if (launch) { this.statusBarItem.text = '$(getting-started-beginner) Linter(modelsim)'; - LspOutput.report(' modelsim linter has been activated', ReportType.Info); + LspOutput.report(' modelsim linter has been activated'); } else { this.statusBarItem.backgroundColor = new vscode.ThemeColor('statusBarItem.warningBackground'); this.statusBarItem.tooltip = 'Fail to launch modelsim linter'; this.statusBarItem.text = '$(extensions-warning-message) Linter(modelsim)'; - LspOutput.report(' Fail to launch modelsim linter', ReportType.Error); + LspOutput.report(' Fail to launch modelsim linter', { + level: ReportType.Error + }); } this.currentLinter = selectedLinter; @@ -168,13 +176,15 @@ class VlogLinterManager implements BaseManager { if (launch) { this.statusBarItem.text = '$(getting-started-beginner) Linter(default)'; - LspOutput.report(' default build-in linter has been activated', ReportType.Info); + LspOutput.report(' default build-in linter has been activated'); } else { this.statusBarItem.backgroundColor = undefined; this.statusBarItem.tooltip = 'Fail to launch default linter'; this.statusBarItem.text = '$(extensions-warning-message) Linter(default)'; - LspOutput.report(' Fail to launch default linter', ReportType.Error); + LspOutput.report(' Fail to launch default linter', { + level: ReportType.Error + }); } this.currentLinter = selectedLinter; diff --git a/src/function/netlist/index.ts b/src/function/netlist/index.ts index acb4a2e..7166f8d 100644 --- a/src/function/netlist/index.ts +++ b/src/function/netlist/index.ts @@ -69,11 +69,15 @@ class Netlist { } if (type === "error") { vscode.window.showErrorMessage('type: ' + type + ', ' + message); - YosysOutput.report('type: ' + type + ', ' + message, ReportType.Error); + YosysOutput.report('type: ' + type + ', ' + message, { + level: ReportType.Error + }); } }); - prjFiles.forEach(file => YosysOutput.report('feed file: ' + file, ReportType.Debug)); + prjFiles.forEach(file => YosysOutput.report('feed file: ' + file, { + level: ReportType.Debug + })); this.kernel.load(prjFiles); this.create(); } @@ -115,7 +119,9 @@ class Netlist { if (this.panel && previewHtml) { this.panel.webview.html = previewHtml; } else { - YosysOutput.report('preview html in is empty', ReportType.Warn); + YosysOutput.report('preview html in is empty', { + level: ReportType.Warn + }); } } diff --git a/src/function/treeView/tree.ts b/src/function/treeView/tree.ts index 40e8ed6..c1fad06 100644 --- a/src/function/treeView/tree.ts +++ b/src/function/treeView/tree.ts @@ -263,7 +263,9 @@ class ModuleTreeProvider implements vscode.TreeDataProvider { moduleDataItemList.push(item); } } else { - MainOutput.report(`cannot find ${element} in hdlParam when constructing treeView`, ReportType.Error); + MainOutput.report(`cannot find ${element} in hdlParam when constructing treeView`, { + level: ReportType.Error + }); } return moduleDataItemList; diff --git a/src/manager/prj.ts b/src/manager/prj.ts index 0b5303e..b9e91b3 100644 --- a/src/manager/prj.ts +++ b/src/manager/prj.ts @@ -114,7 +114,7 @@ class PrjManage { } else { // 先处理 lib 文件 // const fileChange = await libManage.processLibFiles(prjInfo.library); - // MainOutput.report(`libManage finish process, add ${fileChange.add.length} files, del ${fileChange.del.length} files`, ReportType.Info); + // MainOutput.report(`libManage finish process, add ${fileChange.add.length} files, del ${fileChange.del.length} files`; // 默认搜索路径包括: // src, sim, lib @@ -126,7 +126,9 @@ class PrjManage { } const reportMsg = ['', ... searchPathSet.files].join('\n\t'); - MainOutput.report(t('info.launch.search-and-parse') + reportMsg, ReportType.Run); + MainOutput.report(t('info.launch.search-and-parse') + reportMsg, { + level: ReportType.Run + }); // TODO : make something like .gitignore const ignores = hdlIgnore.getIgnoreFiles(); @@ -200,7 +202,9 @@ class PrjManage { // 分析依赖关系错位情况 const unhandleNum = hdlParam.getUnhandleInstanceNumber(); const reportMsg = t('info.initialise.report.title', hdlFiles.length.toString(), unhandleNum.toString()); - MainOutput.report(reportMsg, ReportType.Launch); + MainOutput.report(reportMsg, { + level: ReportType.Launch + }); this.pl = new PlManage(); // TODO : finish it later diff --git a/src/monitor/index.ts b/src/monitor/index.ts index c389986..b4e1540 100644 --- a/src/monitor/index.ts +++ b/src/monitor/index.ts @@ -56,7 +56,9 @@ class HdlMonitor{ } const reportString = ['', ...monitorPathSet.files].join('\n\t'); - MainOutput.report(t('info.launch.following-folder-tracked') + reportString, ReportType.Launch); + MainOutput.report(t('info.launch.following-folder-tracked') + reportString, { + level: ReportType.Launch + }); return this.makeMonitor(monitorFoldersWithGlob); }