fix: regression in updating files

fixes #99 #100
This commit is contained in:
Crawl 2018-11-06 23:50:11 +01:00
parent 4bea1a84df
commit ae3afd7361
No known key found for this signature in database
GPG key ID: E41A6DB922EC2CFE

View file

@ -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')