From 1118b80ccfa64e8bfd8d0fb811f4d9ff6f1941e0 Mon Sep 17 00:00:00 2001 From: Ivan <43139773+ivanmolenaar@users.noreply.github.com> Date: Mon, 1 Jun 2026 09:17:15 +0200 Subject: [PATCH] Make timeouts show an error message instead of success --- manifest.json | 2 +- src/main.ts | 6 +++++- src/settings.ts | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index 3c88d55..700377f 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "csharp-snippet-runner", "name": "CSharp Snippet Runner", - "version": "1.0.3", + "version": "1.0.4", "minAppVersion": "1.12.7", "description": "Run C# code blocks using an auto-installed CSharpRepl runtime.", "author": "OHM Engineering", diff --git a/src/main.ts b/src/main.ts index 5b1960a..221eb7e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -283,7 +283,11 @@ export default class CSharpSnippetRunnerPlugin extends Plugin { clearTimeout(timeoutHandle); if (timedOut) { - resolve({ stdout, stderr }); + const timeoutError = new Error(`CSharpRepl execution timed out after ${timeoutMs}ms. Increase the timeout setting and try again.`) as ReplExecutionError; + timeoutError.code = 'ETIMEDOUT'; + timeoutError.stdout = stdout; + timeoutError.stderr = stderr; + reject(timeoutError); return; } diff --git a/src/settings.ts b/src/settings.ts index 8381d3e..a651b8e 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -6,7 +6,7 @@ export interface CSharpSnippetSettings { } export const DEFAULT_SETTINGS: CSharpSnippetSettings = { - executionTimeoutMs: 3000, + executionTimeoutMs: 10000, }; export class CSharpSnippetSettingTab extends PluginSettingTab { @@ -29,7 +29,7 @@ export class CSharpSnippetSettingTab extends PluginSettingTab { .setName('Execution timeout (ms)') .setDesc('Maximum time to wait before stopping execution and returning captured output.') .addText((text) => text - .setPlaceholder('3000') + .setPlaceholder('10000') .setValue(String(this.plugin.settings.executionTimeoutMs)) .onChange(async (value) => { const parsed = Number.parseInt(value, 10);