添加 netlist 取消的句柄
This commit is contained in:
parent
6834968bc5
commit
0ce43f6628
@ -15,6 +15,7 @@ import { HdlLangID } from '../../global/enum';
|
||||
import { getIconConfig } from '../../hdlFs/icons';
|
||||
import { getDiskLetters, PathSet } from '../../global/util';
|
||||
import { gotoDefinition, saveAsPdf, saveAsSvg } from './api';
|
||||
import { Worker } from 'worker_threads';
|
||||
|
||||
type SynthMode = 'before' | 'after' | 'RTL';
|
||||
|
||||
@ -99,11 +100,20 @@ class Netlist {
|
||||
location: vscode.ProgressLocation.Notification,
|
||||
title: t('info.netlist.generate-network'),
|
||||
cancellable: true
|
||||
}, async () => {
|
||||
const instance = await WebAssembly.instantiate(wasm, {
|
||||
}, async (_, token) => {
|
||||
token.onCancellationRequested(() => {
|
||||
console.log('cancel');
|
||||
fs.closeSync(fd);
|
||||
});
|
||||
|
||||
const instance = WebAssembly.instantiate(wasm, {
|
||||
wasi_snapshot_preview1: wasi.wasiImport
|
||||
});
|
||||
const exitCode = wasi.start(instance);
|
||||
try {
|
||||
const exitCode = wasi.start(instance);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
|
||||
if (!fs.existsSync(targetJson)) {
|
||||
|
18
src/function/dide-netlist/worker.ts
Normal file
18
src/function/dide-netlist/worker.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { isMainThread, Worker, parentPort } from 'worker_threads';
|
||||
|
||||
if (parentPort) {
|
||||
parentPort.on('message', message => {
|
||||
const command = message.command as string;
|
||||
const data = message.data;
|
||||
|
||||
switch (command) {
|
||||
case 'ys':
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -165,6 +165,14 @@ export async function registerLinter(client: LanguageClient) {
|
||||
lspLinter.vhdlLinterManager.updateStatusBar();
|
||||
}
|
||||
});
|
||||
|
||||
// 切换标签页时的行为
|
||||
vscode.window.onDidChangeActiveTextEditor(editor => {
|
||||
if (!editor) {
|
||||
return;
|
||||
}
|
||||
console.log('change to ', editor);
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -340,22 +340,11 @@ export async function refreshWorkspaceDiagonastics(
|
||||
await publishDiagnostics(client, path);
|
||||
}
|
||||
|
||||
const tabs = vscode.window.tabGroups.all;
|
||||
const tabArray = tabs.flatMap<AbsPath>(group => {
|
||||
const files = [];
|
||||
for (const tab of group.tabs) {
|
||||
if (tab.input) {
|
||||
const doc = tab.input as vscode.TabInputText;
|
||||
if (doc.uri) {
|
||||
const absPath = hdlPath.toEscapePath(doc.uri.fsPath);
|
||||
files.push(absPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
return files;
|
||||
});
|
||||
|
||||
await asyncConsumer(tabArray, consumer, parallelChunk, progress);
|
||||
const activeEditor = vscode.window.activeTextEditor;
|
||||
if (activeEditor) {
|
||||
const path = hdlPath.toEscapePath(activeEditor.document.fileName);
|
||||
await asyncConsumer([path], consumer, parallelChunk, progress);
|
||||
}
|
||||
} else {
|
||||
if (!isInitialise) {
|
||||
// shutdown, 如果是初始化阶段,什么都不需要做
|
||||
|
Loading…
x
Reference in New Issue
Block a user