Commit 66e33403 authored by Timon Stampfli's avatar Timon Stampfli

allowing to disable compiler timeout

parent 54809dcf
Pipeline #5681 passed with stages
in 59 seconds
......@@ -110,6 +110,10 @@
{
"command": "soicode.createSolutionForSoitask",
"title": "Create a new cpp solution file for the currently open soitask"
},
{
"command": "soicode.toggleCompilerTimeout",
"title": "Enables/Disables compiler timeout of 10 sec"
}
],
"properties": {},
......
......@@ -104,6 +104,12 @@ export async function activate(context: vscode.ExtensionContext) {
);
context.subscriptions.push(createSolutionForSoitaskCommand);
let toggleDisableCompilerTimeoutCommand = vscode.commands.registerCommand(
"soicode.toggleCompilerTimeout",
toggleDisableCompilerTimeout.bind(undefined, store)
);
context.subscriptions.push(toggleDisableCompilerTimeoutCommand);
let taskTreeViewProvider = new TaskTreeViewProvider(store);
let samplesTreeViewProvider = new SamplesTreeViewProvider(store);
......@@ -134,6 +140,19 @@ async function debugSolutionOnSample() {
);
}
async function toggleDisableCompilerTimeout(store: Store) {
store.disableCompilerTimeout = !store.disableCompilerTimeout;
if (store.disableCompilerTimeout) {
await vscode.window.showInformationMessage(
"Compilation timeout is now disabled"
);
} else {
await vscode.window.showInformationMessage(
"Compilation timeout is now enabled"
);
}
}
// async function updateIsSOITaskContext() {
// let result = await vscode.workspace.findFiles(".soitask");
// console.log(".soitask files: ", result);
......
......@@ -58,8 +58,11 @@ export class Runner {
let finished: vscode.Disposable[] = [];
let finishedTimeout: vscode.Disposable[] = [];
let timer = new Timer(10000);
finished.push(timer);
let timer: Timer | undefined;
if (this.store.disableCompilerTimeout) {
timer = new Timer(10000);
finished.push(timer);
}
const cleanup = (abort?: boolean) => {
for (let d of finished) {
d.dispose();
......@@ -205,10 +208,12 @@ export class Runner {
})
);
await timer.timer;
this.store.logError("compilation", `timed out compilation`);
cleanup(true);
resolve("Failed");
if (timer !== undefined) {
await timer.timer;
this.store.logError("compilation", `timed out compilation`);
cleanup(true);
resolve("Failed");
}
});
}
......
......@@ -27,6 +27,7 @@ export class Store {
allSampleChangeSubscribers: (() => void)[];
sampleUpdateSubscriber: ((s: string) => void)[];
private channel: vscode.OutputChannel;
disableCompilerTimeout: boolean;
constructor(context: vscode.ExtensionContext) {
this.channel = vscode.window.createOutputChannel("soicode");
......@@ -40,6 +41,7 @@ export class Store {
this.fileChangeSubscribers = [];
this.allSampleChangeSubscribers = [];
this.sampleUpdateSubscriber = [];
this.disableCompilerTimeout = false;
this.subscribeStoreToEvents(context);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment