去除 property.json 创建时的自动提示

This commit is contained in:
锦恢 2024-10-27 18:01:56 +08:00
parent 57d63f3b05
commit a1effbb279
9 changed files with 34 additions and 30 deletions

3
doc/error.json Normal file
View File

@ -0,0 +1,3 @@
{
""
}

10
doc/qa.json Normal file
View File

@ -0,0 +1,10 @@
{
"plugin-conflict": {
"question": "digital ide会和其他的verilog插件冲突吗",
"answer": "会,如果是同样注册了 vlog, vhdl, sv, vcd 语言高亮等服务器的插件会和 Digital IDE 冲突,比如 Teros, WaveTrace。因为 vscode 不知道同一个编程语言,到底应该启动哪个插件来提供服务"
},
"": {
"question": "",
"answer": ""
}
}

View File

@ -11,7 +11,7 @@
"progress.choose-best-download-source": "Choose Best Download Source", "progress.choose-best-download-source": "Choose Best Download Source",
"progress.extract-digital-lsp": "Extract Digital LSP", "progress.extract-digital-lsp": "Extract Digital LSP",
"error.download-digital-lsp": "Fail to download digital lsp server, check your network and reload vscode. You can also visit following site and download manually: https://github.com/Digital-EDA/Digital-IDE/releases/tag/", "error.download-digital-lsp": "Fail to download digital lsp server, check your network and reload vscode. You can also visit following site and download manually: https://github.com/Digital-EDA/Digital-IDE/releases/tag/",
"fail.save-file": "保存文件失败", "error.save-file": "保存文件失败",
"save": "保存", "save": "保存",
"save-as-view": "另存为视图文件", "save-as-view": "另存为视图文件",
"vcd-view-file": "vcd 视图文件", "vcd-view-file": "vcd 视图文件",
@ -19,6 +19,6 @@
"load": "加载", "load": "加载",
"load-view-file": "加载视图文件", "load-view-file": "加载视图文件",
"bad-view-file": "视图文件已损坏", "bad-view-file": "视图文件已损坏",
"unexist-direct-vcd-file": "视图文件指向的 vcd 文件不存在", "error.unexist-direct-vcd-file": "视图文件指向的 vcd 文件不存在",
"click.join-qq-group": "Click the link to join the QQ group" "click.join-qq-group": "Click the link to join the QQ group"
} }

View File

@ -11,7 +11,7 @@
"progress.choose-best-download-source": "选择最佳下载源", "progress.choose-best-download-source": "选择最佳下载源",
"progress.extract-digital-lsp": "解压 Digital LSP 语言服务器", "progress.extract-digital-lsp": "解压 Digital LSP 语言服务器",
"error.download-digital-lsp": "无法下载 Digital LSP 语言服务器,检查你的网络后重启 vscode或者请手动去下方地址下载 https://github.com/Digital-EDA/Digital-IDE/releases/tag/", "error.download-digital-lsp": "无法下载 Digital LSP 语言服务器,检查你的网络后重启 vscode或者请手动去下方地址下载 https://github.com/Digital-EDA/Digital-IDE/releases/tag/",
"fail.save-file": "保存文件失败", "error.save-file": "保存文件失败",
"save": "保存", "save": "保存",
"save-as-view": "另存为视图文件", "save-as-view": "另存为视图文件",
"vcd-view-file": "vcd 视图文件", "vcd-view-file": "vcd 视图文件",
@ -19,6 +19,6 @@
"load": "加载", "load": "加载",
"load-view-file": "加载视图文件", "load-view-file": "加载视图文件",
"bad-view-file": "视图文件已损坏", "bad-view-file": "视图文件已损坏",
"unexist-direct-vcd-file": "视图文件指向的 vcd 文件不存在", "error.unexist-direct-vcd-file": "视图文件指向的 vcd 文件不存在",
"click.join-qq-group": "点击链接加入QQ群一起讨论" "click.join-qq-group": "点击链接加入QQ群一起讨论"
} }

View File

@ -11,7 +11,7 @@
"progress.choose-best-download-source": "Choose Best Download Source", "progress.choose-best-download-source": "Choose Best Download Source",
"progress.extract-digital-lsp": "Extract Digital LSP", "progress.extract-digital-lsp": "Extract Digital LSP",
"error.download-digital-lsp": "Fail to download digital lsp server, check your network and reload vscode", "error.download-digital-lsp": "Fail to download digital lsp server, check your network and reload vscode",
"fail.save-file": "保存文件失败", "error.save-file": "保存文件失败",
"save": "保存", "save": "保存",
"save-as-view": "另存为视图文件", "save-as-view": "另存为视图文件",
"vcd-view-file": "vcd 视图文件", "vcd-view-file": "vcd 视图文件",
@ -19,6 +19,6 @@
"load": "加载", "load": "加载",
"load-view-file": "加载视图文件", "load-view-file": "加载视图文件",
"bad-view-file": "视图文件已损坏", "bad-view-file": "视图文件已损坏",
"unexist-direct-vcd-file": "视图文件指向的 vcd 文件不存在", "error.unexist-direct-vcd-file": "视图文件指向的 vcd 文件不存在",
"click.join-qq-group": "点击链接加入QQ群一起讨论" "click.join-qq-group": "点击链接加入QQ群一起讨论"
} }

View File

@ -221,7 +221,7 @@ function getViewLaunchFiles(context: vscode.ExtensionContext, uri: vscode.Uri, p
if (recoverJson.originVcdFile) { if (recoverJson.originVcdFile) {
const vcdPath = recoverJson.originVcdFile; const vcdPath = recoverJson.originVcdFile;
if (!fs.existsSync(vcdPath)) { if (!fs.existsSync(vcdPath)) {
return new Error(t('unexist-direct-vcd-file') + ':' + vcdPath); return new Error(t('error.unexist-direct-vcd-file') + ':' + vcdPath);
} }
const vcd = panel.webview.asWebviewUri(vscode.Uri.file(recoverJson.originVcdFile)).toString(); const vcd = panel.webview.asWebviewUri(vscode.Uri.file(recoverJson.originVcdFile)).toString();
const view = panel.webview.asWebviewUri(uri).toString(); const view = panel.webview.asWebviewUri(uri).toString();

View File

@ -98,7 +98,7 @@ async function askUserToSaveFilelist(filelist: string[]) {
fs.writeFileSync(filePath, fileContent); fs.writeFileSync(filePath, fileContent);
} catch (error) { } catch (error) {
vscode.window.showErrorMessage(t('fail.save-file') + ': ' + error); vscode.window.showErrorMessage(t('error.save-file') + ': ' + error);
} }
} }

View File

@ -4,7 +4,7 @@ import * as childProcess from 'child_process';
import { AbsPath } from "."; import { AbsPath } from ".";
class PathSet { export class PathSet {
files: Set<AbsPath> = new Set<AbsPath>(); files: Set<AbsPath> = new Set<AbsPath>();
add(path: AbsPath) { add(path: AbsPath) {
this.files.add(path); this.files.add(path);
@ -23,7 +23,7 @@ class PathSet {
* @param setA * @param setA
* @param setB * @param setB
*/ */
function isSameSet<T>(setA: Set<T>, setB: Set<T>): boolean { export function isSameSet<T>(setA: Set<T>, setB: Set<T>): boolean {
if (setA.size !== setB.size) { if (setA.size !== setB.size) {
return false; return false;
} }
@ -47,7 +47,7 @@ interface ExecutorOutput {
* @param args argruments * @param args argruments
* @returns { Promise<ExecutorOutput> } * @returns { Promise<ExecutorOutput> }
*/ */
async function easyExec(executor: string, args: string[]): Promise<ExecutorOutput> { export async function easyExec(executor: string, args: string[]): Promise<ExecutorOutput> {
const allArguments = [executor, ...args]; const allArguments = [executor, ...args];
const command = allArguments.join(' '); const command = allArguments.join(' ');
@ -63,7 +63,7 @@ async function easyExec(executor: string, args: string[]): Promise<ExecutorOutpu
/** /**
* Tracks all webviews. * Tracks all webviews.
*/ */
class WebviewCollection { export class WebviewCollection {
private readonly _webviews = new Set<{ private readonly _webviews = new Set<{
readonly resource: string; readonly resource: string;
readonly webviewPanel: vscode.WebviewPanel; readonly webviewPanel: vscode.WebviewPanel;
@ -94,9 +94,11 @@ class WebviewCollection {
} }
} }
export {
PathSet, export function replacePlaceholders(template: string, ...args: string[]): string {
isSameSet, return template.replace(/\$(\d+)/g, (match, p1) => {
easyExec, const index = parseInt(p1, 10) - 1;
WebviewCollection return args[index] !== undefined ? args[index] : match;
}; });
}

View File

@ -86,20 +86,9 @@ class PrjManage {
if (fs.existsSync(propertyJsonPath)) { if (fs.existsSync(propertyJsonPath)) {
const rawPrjInfo = hdlFile.readJSON(propertyJsonPath) as RawPrjInfo; const rawPrjInfo = hdlFile.readJSON(propertyJsonPath) as RawPrjInfo;
opeParam.mergePrjInfo(rawPrjInfo); opeParam.mergePrjInfo(rawPrjInfo);
} else {
const res = await vscode.window.showInformationMessage(
"property.json is not detected, do you want to create one ?",
{ title: 'Yes', value: true },
{ title: 'No', value: false }
);
if (res?.value) {
await this.generatePropertyJson();
const rawPrjInfo = hdlFile.readJSON(propertyJsonPath) as RawPrjInfo;
opeParam.mergePrjInfo(rawPrjInfo);
} else { } else {
refreshPrjConfig.mkdir = false; refreshPrjConfig.mkdir = false;
} }
}
return refreshPrjConfig; return refreshPrjConfig;
} }