From d748d00b567aa7d486a8b310bdc98aaa91d9a7c7 Mon Sep 17 00:00:00 2001 From: Maxime Dufour Date: Thu, 20 Oct 2022 08:40:47 +0000 Subject: [PATCH] Automatic reload: set default to 30 second and check type --- package.json | 2 +- src/virtual_filesystem/logs.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 56ecbf5..744a066 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "properties": { "osc-viewer.refreshConsoleLogs.interval": { "type": "integer", - "default": "5", + "default": 30, "description": "Interval in seconds to refresh console logs." }, "osc-viewer.refreshConsoleLogs.enabled": { diff --git a/src/virtual_filesystem/logs.ts b/src/virtual_filesystem/logs.ts index ce6f024..d61f14b 100644 --- a/src/virtual_filesystem/logs.ts +++ b/src/virtual_filesystem/logs.ts @@ -25,10 +25,15 @@ export class LogsProvider implements vscode.TextDocumentContentProvider { const conf = vscode.workspace.getConfiguration('osc-viewer'); const hasParameter = conf.has("refreshConsoleLogs.enabled"); if (!hasParameter || (hasParameter && conf.get("refreshConsoleLogs.enabled"))) { + const interval = conf.get("refreshConsoleLogs.interval"); + let intervalNumber = 30; + if (typeof interval === 'number') { + intervalNumber = interval; + } this.clock$ = new Observable((subject) => { setInterval(() => { subject.next(); - }, conf.get("refreshConsoleLogs.interval")); + }, 1000 * intervalNumber); }); this.clock$.subscribe(() => { for (const uri of this._documents.keys()) {