find a bug in parsing info output

This commit is contained in:
锦恢 2023-11-27 22:55:45 +08:00
parent 6e95e656f0
commit b5550a2104
26 changed files with 190 additions and 119 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@ parser_stuck.v
out-js/ out-js/
*.pyc *.pyc
*.pyd *.pyd
*.wasm

View File

@ -39,136 +39,133 @@
"configuration": { "configuration": {
"title": "Digital-IDE", "title": "Digital-IDE",
"properties": { "properties": {
"prj.lib.custom.path": { "digital-ide.welcome.show": {
"scope": "window", "type": "boolean",
"default": true,
"description": "show the welcome text in Digital-IDE"
},
"digital-ide.lib.custom.path": {
"type": "string", "type": "string",
"default": "", "default": "",
"description": "path of the dictionary of \"custom\" in library" "description": "path of the dictionary of \"custom\" in library"
}, },
"prj.file.structure.notice": { "digital-ide.prj.file.structure.notice": {
"scope": "window",
"type": "boolean", "type": "boolean",
"default": true, "default": true,
"description": "notice when change file structure" "description": "notice when change file structure"
}, },
"prj.vivado.install.path": { "digital-ide.prj.vivado.install.path": {
"scope": "window",
"type": "string", "type": "string",
"default": "", "default": "",
"description": "Set the xilinx install path. Ignore this setting if you add relative path to environment variable PATH \n e.g. : D:/APP/vivado_18_3/Vivado/2018.3/bin \n Default path is C:/Xilinx/Vivado/2018.3/bin" "description": "Set the xilinx install path. Ignore this setting if you add relative path to environment variable PATH \n e.g. : D:/APP/vivado_18_3/Vivado/2018.3/bin \n Default path is C:/Xilinx/Vivado/2018.3/bin"
}, },
"prj.modelsim.install.path": { "digital-ide.prj.modelsim.install.path": {
"scope": "window",
"type": "string", "type": "string",
"default": "", "default": "",
"description": "set the modelsim install path. Ignore this setting if you add relative path to environment variable PATH \n Default path is C:/modeltech64_10.4/win64" "description": "set the modelsim install path. Ignore this setting if you add relative path to environment variable PATH \n Default path is C:/modeltech64_10.4/win64"
}, },
"prj.xilinx.IP.repo.path": { "digital-ide.prj.xilinx.IP.repo.path": {
"scope": "window",
"type": "string", "type": "string",
"default": "", "default": "",
"description": "User-designed IP libraries from xilinx After configuring this property, the plugin will automatically add the path to the IP repo of vivado." "description": "User-designed IP libraries from xilinx After configuring this property, the plugin will automatically add the path to the IP repo of vivado."
}, },
"prj.xilinx.BD.repo.path": { "digital-ide.prj.xilinx.BD.repo.path": {
"scope": "window",
"type": "string", "type": "string",
"default": "", "default": "",
"description": "User-defined placement path for xilinx block design files" "description": "User-defined placement path for xilinx block design files"
}, },
"prj.xsdk.install.path": { "digital-ide.prj.xsdk.install.path": {
"scope": "window",
"type": "string", "type": "string",
"default": "" "default": ""
}, },
"function.doc.webview.backgroundImage": { "digital-ide.function.doc.webview.backgroundImage": {
"type": "string", "type": "string",
"default": "", "default": "",
"description": "url of the background image" "description": "url of the background image"
}, },
"function.doc.pdf.scale": { "digital-ide.function.doc.pdf.scale": {
"type": "number", "type": "number",
"default": 1, "default": 1,
"description": "scale of the exported pdf" "description": "scale of the exported pdf"
}, },
"function.doc.pdf.printBackground": { "digital-ide.function.doc.pdf.printBackground": {
"type": "boolean", "type": "boolean",
"default": true, "default": true,
"description": "whether print background" "description": "whether print background"
}, },
"function.doc.pdf.landscape": { "digital-ide.function.doc.pdf.landscape": {
"type": "boolean", "type": "boolean",
"default": false, "default": false,
"description": "whether export pdf as a landscape style" "description": "whether export pdf as a landscape style"
}, },
"function.doc.pdf.format": { "digital-ide.function.doc.pdf.format": {
"type": "string", "type": "string",
"default": "A4", "default": "A4",
"description": "format of pdf size" "description": "format of pdf size"
}, },
"function.doc.pdf.displayHeaderFooter": { "digital-ide.function.doc.pdf.displayHeaderFooter": {
"type": "boolean", "type": "boolean",
"default": false, "default": false,
"description": "display header and footer in the exported pdf" "description": "display header and footer in the exported pdf"
}, },
"function.doc.pdf.browserPath": { "digital-ide.function.doc.pdf.browserPath": {
"type": "string", "type": "string",
"default": "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe", "default": "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe",
"description": "the absolute path of edge or chrome, we need browser to render pdf" "description": "the absolute path of edge or chrome, we need browser to render pdf"
}, },
"function.doc.pdf.margin.top": { "digital-ide.function.doc.pdf.margin.top": {
"type": "number", "type": "number",
"default": 0.5, "default": 0.5,
"description": "top margin of exported pdf, unit cm" "description": "top margin of exported pdf, unit cm"
}, },
"function.doc.pdf.margin.right": { "digital-ide.function.doc.pdf.margin.right": {
"type": "number", "type": "number",
"default": 0.5, "default": 0.5,
"description": "top margin of exported pdf, unit cm" "description": "top margin of exported pdf, unit cm"
}, },
"function.doc.pdf.margin.bottom": { "digital-ide.function.doc.pdf.margin.bottom": {
"type": "number", "type": "number",
"default": 0.5, "default": 0.5,
"description": "top margin of exported pdf, unit cm" "description": "top margin of exported pdf, unit cm"
}, },
"function.doc.pdf.margin.left": { "digital-ide.function.doc.pdf.margin.left": {
"type": "number", "type": "number",
"default": 0.5, "default": 0.5,
"description": "top margin of exported pdf, unit cm" "description": "top margin of exported pdf, unit cm"
}, },
"function.doc.pdf.headerTemplate": { "digital-ide.function.doc.pdf.headerTemplate": {
"type": "string", "type": "string",
"default": "<div style=\"font-size: 9px; margin-left: 1cm;\"> <span class='title'></span></div> <div style=\"font-size: 9px; margin-left: auto; margin-right: 1cm; \"> <span class='date'></span></div>", "default": "<div style=\"font-size: 9px; margin-left: 1cm;\"> <span class='title'></span></div> <div style=\"font-size: 9px; margin-left: auto; margin-right: 1cm; \"> <span class='date'></span></div>",
"description": "html template of header, if displayHeaderFooter is set to false, this setting will be ignored" "description": "html template of header, if displayHeaderFooter is set to false, this setting will be ignored"
}, },
"function.doc.pdf.footerTemplate": { "digital-ide.function.doc.pdf.footerTemplate": {
"type": "string", "type": "string",
"default": "<div style=\"font-size: 9px; margin-left: 1cm;\"> <span class='title'></span></div> <div style=\"font-size: 9px; margin-left: auto; margin-right: 1cm; \"> <span class='date'></span></div>", "default": "<div style=\"font-size: 9px; margin-left: 1cm;\"> <span class='title'></span></div> <div style=\"font-size: 9px; margin-left: auto; margin-right: 1cm; \"> <span class='date'></span></div>",
"description": "html template of footer, if displayHeaderFooter is set to false, this setting will be ignored" "description": "html template of footer, if displayHeaderFooter is set to false, this setting will be ignored"
}, },
"function.simulate.icarus.installPath": { "digital-ide.function.simulate.icarus.installPath": {
"type": "string", "type": "string",
"description": "Path of install path of iverilog components, if set to \"\", then iverilog and vvp in environment will be used for simulation. Otherwise, ones that in the install path will be used." "description": "Path of install path of iverilog components, if set to \"\", then iverilog and vvp in environment will be used for simulation. Otherwise, ones that in the install path will be used."
}, },
"function.simulate.simulationHome": { "digital-ide.function.simulate.simulationHome": {
"type": "string", "type": "string",
"description": "Path of simulation folder, .vvp and other file during simulation will be generated here" "description": "Path of simulation folder, .vvp and other file during simulation will be generated here"
}, },
"function.simulate.gtkwavePath": { "digital-ide.function.simulate.gtkwavePath": {
"type": "string", "type": "string",
"default": "gtkwave", "default": "gtkwave",
"description": "Absolute path of launch path of gtkwave software" "description": "Absolute path of launch path of gtkwave software"
}, },
"function.simulate.xilinxLibPath": { "digital-ide.function.simulate.xilinxLibPath": {
"type": "string", "type": "string",
"description": "Path of Xilinx library for simulation" "description": "Path of Xilinx library for simulation"
}, },
"function.simulate.runInTerminal": { "digital-ide.function.simulate.runInTerminal": {
"type": "boolean", "type": "boolean",
"default": false, "default": false,
"description": "run the simulation command in terminal instead of output" "description": "run the simulation command in terminal instead of output"
}, },
"function.lsp.formatter.vlog.default.style": { "digital-ide.function.lsp.formatter.vlog.default.style": {
"scope": "window",
"type": "string", "type": "string",
"enum": [ "enum": [
"kr", "kr",
@ -178,13 +175,12 @@
"default": "kr", "default": "kr",
"description": "Select the verilog and systemverilog formatter style." "description": "Select the verilog and systemverilog formatter style."
}, },
"function.lsp.formatter.vlog.default.args": { "digital-ide.function.lsp.formatter.vlog.default.args": {
"scope": "window",
"type": "string", "type": "string",
"default": "", "default": "",
"description": "Add verilog formatter arguments here (like istyle)." "description": "Add verilog formatter arguments here (like istyle)."
}, },
"function.lsp.formatter.vhdl.default.keyword-case": { "digital-ide.function.lsp.formatter.vhdl.default.keyword-case": {
"description": "Keyword case", "description": "Keyword case",
"type": "string", "type": "string",
"default": "LowerCase", "default": "LowerCase",
@ -193,12 +189,12 @@
"UpperCase" "UpperCase"
] ]
}, },
"function.lsp.formatter.vhdl.default.align-comments": { "digital-ide.function.lsp.formatter.vhdl.default.align-comments": {
"description": "Align comments", "description": "Align comments",
"type": "boolean", "type": "boolean",
"default": false "default": false
}, },
"function.lsp.formatter.vhdl.default.type-name-case": { "digital-ide.function.lsp.formatter.vhdl.default.type-name-case": {
"description": "Type name case", "description": "Type name case",
"type": "string", "type": "string",
"default": "LowerCase", "default": "LowerCase",
@ -207,22 +203,22 @@
"UpperCase" "UpperCase"
] ]
}, },
"function.lsp.formatter.vhdl.default.indentation": { "digital-ide.function.lsp.formatter.vhdl.default.indentation": {
"description": "Indentation", "description": "Indentation",
"type": "number", "type": "number",
"default": 4 "default": 4
}, },
"function.lsp.completion.vlog.autoAddInclude": { "digital-ide.function.lsp.completion.vlog.autoAddInclude": {
"description": "`include \"xxx.v\" will be added to the top of the file automatically", "description": "`include \"xxx.v\" will be added to the top of the file automatically",
"type": "boolean", "type": "boolean",
"default": true "default": true
}, },
"function.lsp.completion.vlog.completeWholeInstante": { "digital-ide.function.lsp.completion.vlog.completeWholeInstante": {
"description": "complete everything invoking a module needs including paramters and ports", "description": "complete everything invoking a module needs including paramters and ports",
"type": "boolean", "type": "boolean",
"default": true "default": true
}, },
"function.lsp.linter.vlog.diagnostor": { "digital-ide.function.lsp.linter.vlog.diagnostor": {
"type": "string", "type": "string",
"enumDescriptions": [ "enumDescriptions": [
"use diagnostor in vivado", "use diagnostor in vivado",
@ -237,7 +233,7 @@
"default": "default", "default": "default",
"description": "choose diagnostor to do linter in editing verilog" "description": "choose diagnostor to do linter in editing verilog"
}, },
"function.lsp.linter.vhdl.diagnostor": { "digital-ide.function.lsp.linter.vhdl.diagnostor": {
"type": "string", "type": "string",
"enumDescriptions": [ "enumDescriptions": [
"use diagnostor in vivado", "use diagnostor in vivado",
@ -252,7 +248,7 @@
"default": "default", "default": "default",
"description": "choose diagnostor to do linter in editing vhdl" "description": "choose diagnostor to do linter in editing vhdl"
}, },
"function.lsp.linter.systemverilog.diagnostor": { "digital-ide.function.lsp.linter.systemverilog.diagnostor": {
"type": "string", "type": "string",
"enumDescriptions": [ "enumDescriptions": [
"use diagnostor in vivado", "use diagnostor in vivado",
@ -267,12 +263,12 @@
"default": "default", "default": "default",
"description": "choose diagnostor to do linter in editing systemverilog" "description": "choose diagnostor to do linter in editing systemverilog"
}, },
"function.instantiation.addComment": { "digital-ide.function.instantiation.addComment": {
"description": "add comment like // ports, // input, // output when doing instantiation, including completion for module invoking", "description": "add comment like // ports, // input, // output when doing instantiation, including completion for module invoking",
"type": "boolean", "type": "boolean",
"default": true "default": true
}, },
"function.instantiation.autoNetOutputDeclaration": { "digital-ide.function.instantiation.autoNetOutputDeclaration": {
"description": "auto declare output type nets in the scope when instantiation happens.", "description": "auto declare output type nets in the scope when instantiation happens.",
"type": "boolean", "type": "boolean",
"default": true "default": true

View File

@ -5,6 +5,9 @@ type AbsPath = string;
type RelPath = string; type RelPath = string;
type Path = AbsPath | RelPath; type Path = AbsPath | RelPath;
export const extensionUrl: string;
interface Fast { interface Fast {
content: RawHdlModule[] content: RawHdlModule[]
languageId: string languageId: string

View File

@ -1,7 +1,12 @@
const hdlParser = require('./parser'); const vscode = require('vscode');
const fs = require('fs'); const fs = require('fs');
const hdlParser = require('./parser');
const { exit } = require('process'); const { exit } = require('process');
const githubIssueUrl = 'https://github.com/Digital-EDA/Digital-IDE/issues';
const extensionUrl = 'https://github.com/Digital-EDA/Digital-IDE';
const _hdlParser = { const _hdlParser = {
module: null, module: null,
tempPath: '/home/hdl_parser', tempPath: '/home/hdl_parser',
@ -37,12 +42,25 @@ async function callParser(path, func) {
wasmModule.FS.writeFile(_hdlParser.tempPath, source, { encoding: 'utf8' }); wasmModule.FS.writeFile(_hdlParser.tempPath, source, { encoding: 'utf8' });
debug.io += Date.now() - s2; debug.io += Date.now() - s2;
try {
const s3 = Date.now(); const s3 = Date.now();
const res = wasmModule.ccall('call_parser', 'string', ['string', 'int', 'int'], [file, fileLength, func]); const res = wasmModule.ccall('call_parser', 'string', ['string', 'int', 'int'], [file, fileLength, func]);
debug.compute += Date.now() - s3; debug.compute += Date.now() - s3;
console.log(path, debug); console.log(path, debug);
return JSON.parse(res); return JSON.parse(res);
} catch (error) {
console.log(`errors happen when call wasm, path: ${path}, errors: ${error}`);
const res = await vscode.window.showErrorMessage(
'Errors happen when parsing ' + path + '. Just propose a valuable issue in our github repo 😊',
{ title: 'Go and Propose!', value: true },
{ title: 'Refuse', value: false }
);
if (res && res.value) {
vscode.env.openExternal(vscode.Uri.parse(githubIssueUrl));
}
return undefined;
}
} }
@ -76,5 +94,6 @@ module.exports = {
vhdlFast, vhdlFast,
vhdlAll, vhdlAll,
svFast, svFast,
svAll svAll,
extensionUrl
}; };

36
script/test/testMain.js Normal file
View File

@ -0,0 +1,36 @@
"use strict";
function* walk(path, ext) {
if (fs.lstatSync(path).isFile()) {
if (path.endsWith(ext)) {
yield path;
}
}
else {
for (const file of fs.readdirSync(path)) {
const stat = fs.lstatSync(path);
const filePath = fspath.join(path, file);
if (stat.isDirectory()) {
for (const targetPath of walk(filePath, ext)) {
yield targetPath;
}
}
else if (stat.isFile()) {
if (filePath.endsWith(ext)) {
yield filePath;
}
}
}
}
}
async function test(context) {
if (vscode.workspace.workspaceFolders !== undefined &&
vscode.workspace.workspaceFolders.length !== 0) {
const wsPath = hdlPath.toSlash(vscode.workspace.workspaceFolders[0].uri.fsPath);
for (const file of walk(wsPath, '.v')) {
if (typeof file === 'string') {
const fast = await vlogFast(file);
}
}
}
}
//# sourceMappingURL=testMain.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"testMain.js","sourceRoot":"","sources":["testMain.ts"],"names":[],"mappings":";AACA,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAa,EAAE,GAAW;IACrC,IAAI,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;QAC7B,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACpB,MAAM,IAAI,CAAC;SACd;KACJ;SAAM;QACH,KAAK,MAAM,IAAI,IAAI,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;YACrC,MAAM,IAAI,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAChC,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YACzC,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE;gBACpB,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE;oBAC1C,MAAM,UAAU,CAAC;iBACpB;aACJ;iBAAM,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE;gBACtB,IAAI,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;oBACxB,MAAM,QAAQ,CAAC;iBAClB;aACJ;SACJ;KACJ;AACL,CAAC;AAGD,KAAK,UAAU,IAAI,CAAC,OAAgC;IAChD,IAAI,MAAM,CAAC,SAAS,CAAC,gBAAgB,KAAK,SAAS;QAC/C,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE;QAChD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAChF,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;YACnC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;gBAC1B,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;aACrC;SACJ;KACJ;AACL,CAAC"}

35
script/test/testMain.ts Normal file
View File

@ -0,0 +1,35 @@
function* walk(path: AbsPath, ext: string): Generator {
if (fs.lstatSync(path).isFile()) {
if (path.endsWith(ext)) {
yield path;
}
} else {
for (const file of fs.readdirSync(path)) {
const stat = fs.lstatSync(path);
const filePath = fspath.join(path, file);
if (stat.isDirectory()) {
for (const targetPath of walk(filePath, ext)) {
yield targetPath;
}
} else if (stat.isFile()) {
if (filePath.endsWith(ext)) {
yield filePath;
}
}
}
}
}
async function test(context: vscode.ExtensionContext) {
if (vscode.workspace.workspaceFolders !== undefined &&
vscode.workspace.workspaceFolders.length !== 0) {
const wsPath = hdlPath.toSlash(vscode.workspace.workspaceFolders[0].uri.fsPath);
for (const file of walk(wsPath, '.v')) {
if (typeof file === 'string') {
const fast = await vlogFast(file);
}
}
}
}

View File

@ -1,6 +1,6 @@
const { vlogFast } = require('../../resources/hdlParser'); const { vlogFast } = require('../../resources/hdlParser');
const testFile = 'c:/Users/11934/Project/Digital-IDE/Digital-Test/Verilog/dependence_test/parent.v'; const testFile = 'c:/Users/11934/Project/Digital-IDE/Digital-Test/Verilog/dependence_test/head_1.v';
(async () => { (async () => {
const fast = await vlogFast(testFile); const fast = await vlogFast(testFile);

View File

@ -2,13 +2,13 @@ import * as vscode from 'vscode';
import * as fs from 'fs'; import * as fs from 'fs';
import * as fspath from 'path'; import * as fspath from 'path';
import { opeParam, MainOutput, AbsPath } from './global'; import { opeParam, MainOutput, AbsPath, ReportType } from './global';
import { hdlParam } from './hdlParser'; import { hdlParam } from './hdlParser';
import * as manager from './manager'; import * as manager from './manager';
import * as func from './function'; import * as func from './function';
import { hdlMonitor } from './monitor'; import { hdlMonitor } from './monitor';
import { hdlPath } from './hdlFs'; import { hdlPath } from './hdlFs';
import { vlogFast } from '../resources/hdlParser'; import { extensionUrl } from '../resources/hdlParser';
async function registerCommand(context: vscode.ExtensionContext) { async function registerCommand(context: vscode.ExtensionContext) {
manager.registerManagerCommands(context); manager.registerManagerCommands(context);
@ -20,52 +20,32 @@ async function registerCommand(context: vscode.ExtensionContext) {
func.registerNetlist(context); func.registerNetlist(context);
} }
function* walk(path: AbsPath, ext: string): Generator {
if (fs.lstatSync(path).isFile()) {
if (path.endsWith(ext)) {
yield path;
}
} else {
for (const file of fs.readdirSync(path)) {
const stat = fs.lstatSync(path);
const filePath = fspath.join(path, file);
if (stat.isDirectory()) {
for (const targetPath of walk(filePath, ext)) {
yield targetPath;
}
} else if (stat.isFile()) {
if (filePath.endsWith(ext)) {
yield filePath;
}
}
}
}
}
async function test(context: vscode.ExtensionContext) {
if (vscode.workspace.workspaceFolders !== undefined &&
vscode.workspace.workspaceFolders.length !== 0) {
const wsPath = hdlPath.toSlash(vscode.workspace.workspaceFolders[0].uri.fsPath);
for (const file of walk(wsPath, '.v')) {
if (typeof file === 'string') {
await vlogFast(file);
}
}
}
}
async function launch(context: vscode.ExtensionContext) { async function launch(context: vscode.ExtensionContext) {
await manager.prjManage.initialise(context); await manager.prjManage.initialise(context);
await registerCommand(context); await registerCommand(context);
hdlMonitor.start(); hdlMonitor.start();
// await vlogFast("e:/Project/Digial-IDE/TestWs/simulate/user/sim/tb_file/scc018ug_hd_rvt.v");
MainOutput.report('Digital-IDE has launched, Version: 0.3.0'); MainOutput.report('Digital-IDE has launched, Version: 0.3.0');
MainOutput.report('OS: ' + opeParam.os); MainOutput.report('OS: ' + opeParam.os);
console.log(hdlParam); console.log(hdlParam);
// show welcome information (if first install)
const welcomeSetting = vscode.workspace.getConfiguration('digital-ide.welcome');
const showWelcome = welcomeSetting.get('show', true);
if (showWelcome) {
// don't show in next time
welcomeSetting.update('show', false);
const res = await vscode.window.showInformationMessage(
'Thanks for using Digital-IDE ❤️. Your star will be our best motivation! 😊',
{ title: 'Star', value: true },
{ title: 'Refuse', value: true },
);
if (res?.value) {
vscode.env.openExternal(vscode.Uri.parse(extensionUrl));
}
}
} }
export function activate(context: vscode.ExtensionContext) { export function activate(context: vscode.ExtensionContext) {

View File

@ -126,7 +126,7 @@ async function makeShowHTML(usage: string): Promise<string> {
// add css // add css
let cssString = getDocCssString(); let cssString = getDocCssString();
if (usage === 'webview') { // if invoked by webview, change background image if (usage === 'webview') { // if invoked by webview, change background image
const webviewConfig = vscode.workspace.getConfiguration("function.doc.webview"); const webviewConfig = vscode.workspace.getConfiguration("digital-ide.function.doc.webview");
const imageUrl = webviewConfig.get('backgroundImage', ''); const imageUrl = webviewConfig.get('backgroundImage', '');
cssString = cssString.replace("--backgroundImage", imageUrl); cssString = cssString.replace("--backgroundImage", imageUrl);
} else if (usage === 'pdf') { // if invoked by pdf, transform .vscode-light to #write } else if (usage === 'pdf') { // if invoked by pdf, transform .vscode-light to #write

View File

@ -21,7 +21,7 @@ function getDefaultBrowerPath(): AbsPath {
* @param pdfPath output path of pdf * @param pdfPath output path of pdf
*/ */
async function htmlFile2PdfFile(htmlPath: AbsPath, pdfPath: AbsPath) { async function htmlFile2PdfFile(htmlPath: AbsPath, pdfPath: AbsPath) {
const pdfConfig = vscode.workspace.getConfiguration("function.doc.pdf"); const pdfConfig = vscode.workspace.getConfiguration("digital-ide.function.doc.pdf");
const platformDefaultBrowerPath = getDefaultBrowerPath(); const platformDefaultBrowerPath = getDefaultBrowerPath();
const browserPath = pdfConfig.get('browserPath', platformDefaultBrowerPath); const browserPath = pdfConfig.get('browserPath', platformDefaultBrowerPath);

View File

@ -117,7 +117,7 @@ class VhdlCompletionProvider implements vscode.CompletionItemProvider {
private async provideModules(document: vscode.TextDocument, position: vscode.Position, filePath: AbsPath, includes: Include[]): Promise<vscode.CompletionItem[]> { private async provideModules(document: vscode.TextDocument, position: vscode.Position, filePath: AbsPath, includes: Include[]): Promise<vscode.CompletionItem[]> {
const suggestModules: vscode.CompletionItem[] = []; const suggestModules: vscode.CompletionItem[] = [];
const lspVhdlConfig = vscode.workspace.getConfiguration('function.lsp.completion.vhdl'); const lspVhdlConfig = vscode.workspace.getConfiguration('digital-ide.function.lsp.completion.vhdl');
const autoAddInclude: boolean = lspVhdlConfig.get('autoAddInclude', true); const autoAddInclude: boolean = lspVhdlConfig.get('autoAddInclude', true);
const completeWholeInstante: boolean = lspVhdlConfig.get('completeWholeInstante', true); const completeWholeInstante: boolean = lspVhdlConfig.get('completeWholeInstante', true);

View File

@ -287,7 +287,7 @@ class VlogCompletionProvider implements vscode.CompletionItemProvider {
private async provideModules(document: vscode.TextDocument, position: vscode.Position, filePath: AbsPath, includes: Include[]): Promise<vscode.CompletionItem[]> { private async provideModules(document: vscode.TextDocument, position: vscode.Position, filePath: AbsPath, includes: Include[]): Promise<vscode.CompletionItem[]> {
const suggestModules: vscode.CompletionItem[] = []; const suggestModules: vscode.CompletionItem[] = [];
const lspVlogConfig = vscode.workspace.getConfiguration('function.lsp.completion.vlog'); const lspVlogConfig = vscode.workspace.getConfiguration('digital-ide.function.lsp.completion.vlog');
const autoAddInclude: boolean = lspVlogConfig.get('autoAddInclude', true); const autoAddInclude: boolean = lspVlogConfig.get('autoAddInclude', true);
const completeWholeInstante: boolean = lspVlogConfig.get('completeWholeInstante', true); const completeWholeInstante: boolean = lspVlogConfig.get('completeWholeInstante', true);

View File

@ -127,7 +127,7 @@ class ModelsimLinter implements BaseLinter {
private getExecutableFilePath(langID: HdlLangID): string | Path | undefined { private getExecutableFilePath(langID: HdlLangID): string | Path | undefined {
// modelsim install path stored in prj.modelsim.install.path // modelsim install path stored in prj.modelsim.install.path
const modelsimConfig = vscode.workspace.getConfiguration('prj.modelsim'); const modelsimConfig = vscode.workspace.getConfiguration('digital-ide.prj.modelsim');
const modelsimInstallPath = modelsimConfig.get('install.path', ''); const modelsimInstallPath = modelsimConfig.get('install.path', '');
const executorName = this.executableFileMap.get(langID); const executorName = this.executableFileMap.get(langID);
if (executorName === undefined) { if (executorName === undefined) {

View File

@ -106,7 +106,7 @@ class VerilatorLinter implements BaseLinter {
private getExecutableFilePath(langID: HdlLangID): string | Path | undefined { private getExecutableFilePath(langID: HdlLangID): string | Path | undefined {
// verilator install path stored in prj.verilator.install.path // verilator install path stored in prj.verilator.install.path
const verilatorConfig = vscode.workspace.getConfiguration('prj.verilator'); const verilatorConfig = vscode.workspace.getConfiguration('digital-ide.prj.verilator');
const verilatorInstallPath = verilatorConfig.get('install.path', ''); const verilatorInstallPath = verilatorConfig.get('install.path', '');
const executorName = this.executableFileMap.get(langID); const executorName = this.executableFileMap.get(langID);
if (executorName === undefined) { if (executorName === undefined) {

View File

@ -52,7 +52,7 @@ class VhdlLinterManager implements BaseManager {
} }
public getUserDiagnostorSelection() { public getUserDiagnostorSelection() {
const vlogLspConfig = vscode.workspace.getConfiguration('function.lsp.linter.vlog'); const vlogLspConfig = vscode.workspace.getConfiguration('digital-ide.function.lsp.linter.vlog');
const diagnostor = vlogLspConfig.get('diagnostor', 'default'); const diagnostor = vlogLspConfig.get('diagnostor', 'default');
return diagnostor; return diagnostor;
} }

View File

@ -124,7 +124,7 @@ class VivadoLinter implements BaseLinter {
private getExecutableFilePath(langID: HdlLangID): string | Path | undefined { private getExecutableFilePath(langID: HdlLangID): string | Path | undefined {
// vivado install path stored in prj.vivado.install.path // vivado install path stored in prj.vivado.install.path
const vivadoConfig = vscode.workspace.getConfiguration('prj.vivado'); const vivadoConfig = vscode.workspace.getConfiguration('digital-ide.prj.vivado');
const vivadoInstallPath = vivadoConfig.get('install.path', ''); const vivadoInstallPath = vivadoConfig.get('install.path', '');
const executorName = this.executableFileMap.get(langID); const executorName = this.executableFileMap.get(langID);
if (executorName === undefined) { if (executorName === undefined) {

View File

@ -54,7 +54,7 @@ class VlogLinterManager implements BaseManager {
} }
public getUserDiagnostorSelection() { public getUserDiagnostorSelection() {
const vlogLspConfig = vscode.workspace.getConfiguration('function.lsp.linter.vlog'); const vlogLspConfig = vscode.workspace.getConfiguration('digital-ide.function.lsp.linter.vlog');
const diagnostor = vlogLspConfig.get('diagnostor', 'default'); const diagnostor = vlogLspConfig.get('diagnostor', 'default');
return diagnostor; return diagnostor;
} }

View File

@ -29,7 +29,7 @@ class ModuleInfoItem {
* @param module * @param module
*/ */
function instanceVlogCode(module: HdlModule, prefix: string = '', returnSnippetString: boolean = false): string { function instanceVlogCode(module: HdlModule, prefix: string = '', returnSnippetString: boolean = false): string {
const instantiationConfig = vscode.workspace.getConfiguration('function.instantiation'); const instantiationConfig = vscode.workspace.getConfiguration('digital-ide.function.instantiation');
const needComment = instantiationConfig.get('addComment', true); const needComment = instantiationConfig.get('addComment', true);
const autoNetOutputDeclaration = instantiationConfig.get('autoNetOutputDeclaration', true); const autoNetOutputDeclaration = instantiationConfig.get('autoNetOutputDeclaration', true);

View File

@ -70,7 +70,7 @@ class Simulate {
// make simulation dir // make simulation dir
const defaultSimulationDir = hdlPath.join(opeParam.prjInfo.arch.prjPath, 'simulation', 'icarus'); const defaultSimulationDir = hdlPath.join(opeParam.prjInfo.arch.prjPath, 'simulation', 'icarus');
simConfig.simulationHome = setting.get('function.simulate.simulationHome', ''); simConfig.simulationHome = setting.get('digital-ide.function.simulate.simulationHome', '');
if (!fs.existsSync(simConfig.simulationHome)) { if (!fs.existsSync(simConfig.simulationHome)) {
simConfig.simulationHome = defaultSimulationDir; simConfig.simulationHome = defaultSimulationDir;
} }
@ -81,7 +81,7 @@ class Simulate {
hdlDir.mkdir(simConfig.simulationHome); hdlDir.mkdir(simConfig.simulationHome);
} }
simConfig.gtkwavePath = setting.get('function.simulate.gtkwavePath', 'gtkwave'); simConfig.gtkwavePath = setting.get('digital-ide.function.simulate.gtkwavePath', 'gtkwave');
if (simConfig.gtkwavePath !== '' && !hdlFile.isDir(simConfig.gtkwavePath)) { if (simConfig.gtkwavePath !== '' && !hdlFile.isDir(simConfig.gtkwavePath)) {
simConfig.gtkwavePath = 'gtkwave'; // 如果不存在则认为是加入了环境变量 simConfig.gtkwavePath = 'gtkwave'; // 如果不存在则认为是加入了环境变量
@ -93,7 +93,7 @@ class Simulate {
} }
} }
simConfig.installPath = setting.get('function.simulate.icarus.installPath', ''); simConfig.installPath = setting.get('digital-ide.function.simulate.icarus.installPath', '');
if (simConfig.installPath !== '' && !hdlFile.isDir(simConfig.installPath)) { if (simConfig.installPath !== '' && !hdlFile.isDir(simConfig.installPath)) {
MainOutput.report(`install path ${simConfig.installPath} is illegal`, ReportType.Error, true); MainOutput.report(`install path ${simConfig.installPath} is illegal`, ReportType.Error, true);
return; return;
@ -112,7 +112,7 @@ class Simulate {
// 获取xilinx的自带仿真库的路径 // 获取xilinx的自带仿真库的路径
if (toolChain === ToolChainType.Xilinx) { if (toolChain === ToolChainType.Xilinx) {
const simLibPath = setting.get('function.simulate.xilinxLibPath', ''); const simLibPath = setting.get('digital-ide.function.simulate.xilinxLibPath', '');
if (!hdlFile.isDir(simLibPath)) { if (!hdlFile.isDir(simLibPath)) {
return []; return [];
@ -297,7 +297,7 @@ class IcarusSimulate extends Simulate {
return; return;
} }
const runInTerminal = vscode.workspace.getConfiguration().get('function.simulate.runInTerminal'); const runInTerminal = vscode.workspace.getConfiguration().get('digital-ide.function.simulate.runInTerminal');
if (runInTerminal) { if (runInTerminal) {
this.execInTerminal(command, cwd); this.execInTerminal(command, cwd);

View File

@ -558,7 +558,7 @@ class PrjInfo implements PrjInfoMeta {
} }
public get libCustomPath(): AbsPath { public get libCustomPath(): AbsPath {
const libPath = vscode.workspace.getConfiguration().get('prj.lib.custom.path', this._workspacePath); const libPath = vscode.workspace.getConfiguration().get('digital-ide.prj.lib.custom.path', this._workspacePath);
if (!fs.existsSync(libPath)) { if (!fs.existsSync(libPath)) {
return ''; return '';
} }

View File

@ -31,7 +31,7 @@ class PlManage extends BaseManage {
const curToolChain = this.config.tool; const curToolChain = this.config.tool;
if (curToolChain === ToolChainType.Xilinx) { if (curToolChain === ToolChainType.Xilinx) {
const vivadoPath = vscode.workspace.getConfiguration('prj.vivado.install').get('path', ''); const vivadoPath = vscode.workspace.getConfiguration('digital-ide.prj.vivado.install').get('path', '');
if (hdlFile.isDir(vivadoPath)) { if (hdlFile.isDir(vivadoPath)) {
this.config.path = hdlPath.join(hdlPath.toSlash(vivadoPath), 'vivado'); this.config.path = hdlPath.join(hdlPath.toSlash(vivadoPath), 'vivado');
if (opeParam.os === 'win32') { if (opeParam.os === 'win32') {

View File

@ -104,8 +104,8 @@ class XilinxOperation {
public get custom(): XilinxCustom { public get custom(): XilinxCustom {
return { return {
ipRepo: vscode.workspace.getConfiguration().get('prj.xilinx.IP.repo.path', ''), ipRepo: vscode.workspace.getConfiguration().get('digital-ide.prj.xilinx.IP.repo.path', ''),
bdRepo: vscode.workspace.getConfiguration().get('prj.xilinx.BD.repo.path', '') bdRepo: vscode.workspace.getConfiguration().get('digital-ide.prj.xilinx.BD.repo.path', '')
}; };
} }
@ -588,7 +588,7 @@ class XilinxBd {
this.schemaCont = hdlFile.readJSON(this.schemaPath) as PropertySchema; this.schemaCont = hdlFile.readJSON(this.schemaPath) as PropertySchema;
this.bdEnum = this.schemaCont.properties.soc.properties.bd.enum; this.bdEnum = this.schemaCont.properties.soc.properties.bd.enum;
this.bdRepo = this.setting.get('PRJ.xilinx.BD.repo.path', ''); this.bdRepo = this.setting.get('digital-ide.prj.xilinx.BD.repo.path', '');
} }
getConfig() { getConfig() {
@ -597,7 +597,7 @@ class XilinxBd {
this.schemaPath = opeParam.propertySchemaPath; this.schemaPath = opeParam.propertySchemaPath;
this.schemaCont = hdlFile.readJSON(this.schemaPath) as PropertySchema; this.schemaCont = hdlFile.readJSON(this.schemaPath) as PropertySchema;
this.bdEnum = this.schemaCont.properties?.soc.properties.bd.enum; this.bdEnum = this.schemaCont.properties?.soc.properties.bd.enum;
this.bdRepo = this.setting.get('PRJ.xilinx.BD.repo.path', ''); this.bdRepo = this.setting.get('digital-ide.prj.xilinx.BD.repo.path', '');
} }
async overwrite(uri: vscode.Uri): Promise<void> { async overwrite(uri: vscode.Uri): Promise<void> {
@ -638,7 +638,7 @@ class XilinxBd {
} }
// 获取存放路径 // 获取存放路径
let storePath = this.setting.get('PRJ.xilinx.BD.repo.path', ''); let storePath = this.setting.get('digital-ide.prj.xilinx.BD.repo.path', '');
if (!fs.existsSync(storePath)) { if (!fs.existsSync(storePath)) {
vscode.window.showWarningMessage(`This bd file will be added into extension folder.We don't recommend doing this because it will be cleared in the next update.`); vscode.window.showWarningMessage(`This bd file will be added into extension folder.We don't recommend doing this because it will be cleared in the next update.`);
storePath = this.xbdPath; storePath = this.xbdPath;

View File

@ -31,7 +31,7 @@ class PsManage extends BaseManage {
// get install path & operation object // get install path & operation object
if (this.config.tool === ToolChainType.Xilinx) { if (this.config.tool === ToolChainType.Xilinx) {
const xsdkPath = vscode.workspace.getConfiguration('prj.xsdk.install').get('path', ''); const xsdkPath = vscode.workspace.getConfiguration('digital-ide.prj.xsdk.install').get('path', '');
if (hdlFile.isDir(xsdkPath)) { if (hdlFile.isDir(xsdkPath)) {
this.config.path = hdlPath.join(hdlPath.toSlash(xsdkPath), 'xsct'); this.config.path = hdlPath.join(hdlPath.toSlash(xsdkPath), 'xsct');
if (opeParam.os === "win32") { if (opeParam.os === "win32") {

View File

@ -153,7 +153,7 @@ class LibManage {
public async deleteLocalFiles() { public async deleteLocalFiles() {
if (fs.existsSync(this.localLibPath)) { if (fs.existsSync(this.localLibPath)) {
const needNotice = vscode.workspace.getConfiguration('prj.file.structure.notice'); const needNotice = vscode.workspace.getConfiguration('digital-ide.prj.file.structure.notice');
if (needNotice) { if (needNotice) {
const res = await vscode.window.showWarningMessage( const res = await vscode.window.showWarningMessage(
`Local Lib (${this.localLibPath}) will be removed.`, `Local Lib (${this.localLibPath}) will be removed.`,

View File

@ -243,7 +243,7 @@ class PrjManage {
hdlDir.mkdir(softwareSrcPath); hdlDir.mkdir(softwareSrcPath);
} }
else if (currmode === "LS" && nextmode === "PL") { else if (currmode === "LS" && nextmode === "PL") {
const needNotice = vscode.workspace.getConfiguration().get('PRJ.file.structure.notice', true); const needNotice = vscode.workspace.getConfiguration().get('digital-ide.prj.file.structure.notice', true);
if (needNotice) { if (needNotice) {
const res = await vscode.window.showWarningMessage( const res = await vscode.window.showWarningMessage(
"Software will be deleted.", "Software will be deleted.",