vcd 兼容 vscode 1.95.0
This commit is contained in:
parent
206fbf5a56
commit
a0f75eeea2
@ -9,7 +9,7 @@
|
|||||||
"l10n": "./l10n",
|
"l10n": "./l10n",
|
||||||
"icon": "images/icon.png",
|
"icon": "images/icon.png",
|
||||||
"engines": {
|
"engines": {
|
||||||
"vscode": "^1.72.0"
|
"vscode": "^1.95.0"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"FPGA Develop Support",
|
"FPGA Develop Support",
|
||||||
|
@ -15,7 +15,9 @@ export interface SaveViewData {
|
|||||||
export interface LaunchFiles {
|
export interface LaunchFiles {
|
||||||
vcd: string,
|
vcd: string,
|
||||||
view: string,
|
view: string,
|
||||||
|
vcdjs: string,
|
||||||
worker: string,
|
worker: string,
|
||||||
|
wasm: string,
|
||||||
root: string
|
root: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,12 +59,13 @@ class WaveViewer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { vcd, view, worker, root } = launchFiles;
|
const { vcd, view, wasm, vcdjs, worker, root } = launchFiles;
|
||||||
let preprocessHtml = previewHtml
|
let preprocessHtml = previewHtml
|
||||||
.replace('test.vcd', vcd)
|
.replace('test.vcd', vcd)
|
||||||
.replace('test.view', view)
|
.replace('test.view', view)
|
||||||
.replace('worker.js', worker)
|
.replace('vcd.js', vcdjs)
|
||||||
.replace('<root>', root);
|
.replace('vcd.wasm', wasm)
|
||||||
|
.replace('worker.js', worker);
|
||||||
this.panel.webview.html = preprocessHtml;
|
this.panel.webview.html = preprocessHtml;
|
||||||
this.panel.iconPath = getIconConfig('view');
|
this.panel.iconPath = getIconConfig('view');
|
||||||
registerMessageEvent(this.panel, uri);
|
registerMessageEvent(this.panel, uri);
|
||||||
@ -125,12 +126,14 @@ class VcdViewerProvider implements vscode.CustomEditorProvider {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { vcd, view, worker, root } = launchFiles;
|
const { vcd, view, wasm, vcdjs, worker, root } = launchFiles;
|
||||||
let preprocessHtml = previewHtml
|
let preprocessHtml = previewHtml
|
||||||
.replace('test.vcd', vcd)
|
.replace('test.vcd', vcd)
|
||||||
.replace('test.view', view)
|
.replace('test.view', view)
|
||||||
.replace('worker.js', worker)
|
.replace('vcd.js', vcdjs)
|
||||||
.replace('<root>', root);
|
.replace('vcd.wasm', wasm)
|
||||||
|
.replace('worker.js', worker);
|
||||||
|
|
||||||
webviewPanel.webview.html = preprocessHtml;
|
webviewPanel.webview.html = preprocessHtml;
|
||||||
webviewPanel.iconPath = getIconConfig('view');
|
webviewPanel.iconPath = getIconConfig('view');
|
||||||
} else {
|
} else {
|
||||||
@ -200,12 +203,14 @@ function registerMessageEvent(panel: vscode.WebviewPanel, uri: vscode.Uri) {
|
|||||||
*/
|
*/
|
||||||
function getViewLaunchFiles(context: vscode.ExtensionContext, uri: vscode.Uri, panel: vscode.WebviewPanel): LaunchFiles | Error {
|
function getViewLaunchFiles(context: vscode.ExtensionContext, uri: vscode.Uri, panel: vscode.WebviewPanel): LaunchFiles | Error {
|
||||||
const { t } = vscode.l10n;
|
const { t } = vscode.l10n;
|
||||||
console.log(uri.fsPath);
|
|
||||||
|
|
||||||
const entryPath = uri.fsPath;
|
const entryPath = uri.fsPath;
|
||||||
const dideviewerPath = hdlPath.join(context.extensionPath, 'resources', 'dide-viewer', 'view');
|
const dideviewerPath = hdlPath.join(context.extensionPath, 'resources', 'dide-viewer', 'view');
|
||||||
const workerAbsPath = hdlPath.join(dideviewerPath, 'worker.js');
|
const workerAbsPath = hdlPath.join(dideviewerPath, 'worker.js');
|
||||||
|
const vcdjsAbsPath = hdlPath.join(dideviewerPath, 'vcd.js');
|
||||||
|
const wasmAbsPath = hdlPath.join(dideviewerPath, 'vcd.wasm');
|
||||||
const worker = panel.webview.asWebviewUri(vscode.Uri.file(workerAbsPath)).toString();
|
const worker = panel.webview.asWebviewUri(vscode.Uri.file(workerAbsPath)).toString();
|
||||||
|
const vcdjs = panel.webview.asWebviewUri(vscode.Uri.file(vcdjsAbsPath)).toString();
|
||||||
|
const wasm = panel.webview.asWebviewUri(vscode.Uri.file(wasmAbsPath)).toString();
|
||||||
const root = panel.webview.asWebviewUri(vscode.Uri.file(dideviewerPath)).toString();
|
const root = panel.webview.asWebviewUri(vscode.Uri.file(dideviewerPath)).toString();
|
||||||
|
|
||||||
// 根据打开文件的类型来判断资源加载方案
|
// 根据打开文件的类型来判断资源加载方案
|
||||||
@ -214,7 +219,7 @@ function getViewLaunchFiles(context: vscode.ExtensionContext, uri: vscode.Uri, p
|
|||||||
const vcd = panel.webview.asWebviewUri(uri).toString();
|
const vcd = panel.webview.asWebviewUri(uri).toString();
|
||||||
const view = panel.webview.asWebviewUri(vscode.Uri.file(defaultViewPath)).toString();
|
const view = panel.webview.asWebviewUri(vscode.Uri.file(defaultViewPath)).toString();
|
||||||
|
|
||||||
return { vcd, view, worker, root };
|
return { vcd, view, wasm, vcdjs, worker, root };
|
||||||
} else if (entryPath.endsWith('.view')) {
|
} else if (entryPath.endsWith('.view')) {
|
||||||
const buffer = fs.readFileSync(entryPath);
|
const buffer = fs.readFileSync(entryPath);
|
||||||
const recoverJson = BSON.deserialize(buffer);
|
const recoverJson = BSON.deserialize(buffer);
|
||||||
@ -226,7 +231,7 @@ function getViewLaunchFiles(context: vscode.ExtensionContext, uri: vscode.Uri, p
|
|||||||
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();
|
||||||
|
|
||||||
return { vcd, view, worker, root };
|
return { vcd, view, wasm, vcdjs, worker, root };
|
||||||
} else {
|
} else {
|
||||||
return new Error(t('error.vcd-viewer.bad-view-file') + ':' + entryPath);
|
return new Error(t('error.vcd-viewer.bad-view-file') + ':' + entryPath);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user