From ae3afd7361c98e57364a94966eb758c61fb28ae6 Mon Sep 17 00:00:00 2001 From: Crawl Date: Tue, 6 Nov 2018 23:50:11 +0100 Subject: [PATCH] fix: regression in updating files fixes #99 #100 --- src/extension.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 9e68b98..8510bef 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -5,7 +5,6 @@ import { setInterval, clearInterval } from 'timers'; import { commands, debug, - Disposable, env, ExtensionContext, StatusBarItem, @@ -24,6 +23,17 @@ interface FileDetail { currentColumn: string | null; } +interface Activity { + details: string; + state: string; + startTimestamp: number | null; + largeImageKey: string; + largeImageText: string; + smallImageKey: string; + smallImageText: string; + instance: boolean; +} + const knownExtentions: { [x: string]: { image: string } } = lang.knownExtentions; const knownLanguages: string[] = lang.knownLanguages; @@ -38,7 +48,7 @@ let reconnectCounter = 0; // Define the last known file and its type. let lastKnownFile: string; // Define the activity object. -let activity: object; +let activity: Activity; // Define the activity timer to not spam the API with requests. let activityTimer: NodeJS.Timer; // Define the status bar icon @@ -232,8 +242,8 @@ function setActivity(workspaceElapsedTime: boolean = false): void { if (window.activeTextEditor && window.activeTextEditor.document.fileName === lastKnownFile) { activity = { ...activity, - details: generateDetails('detailsDebugging', 'detailsEditing', 'detailsIdle', this.largeImageKey), - state: generateDetails('lowerDetailsDebugging', 'lowerDetailsEditing', 'lowerDetailsIdle', this.largeImageKey), + details: generateDetails('detailsDebugging', 'detailsEditing', 'detailsIdle', activity.largeImageKey), + state: generateDetails('lowerDetailsDebugging', 'lowerDetailsEditing', 'lowerDetailsIdle', activity.largeImageKey), smallImageKey: debug.activeDebugSession ? 'debug' : env.appName.includes('Insiders')