1 import * as vscode from 'vscode';
2 import { log } from './util';
4 export class PersistentState {
5 constructor(private readonly globalState: vscode.Memento) {
6 const { lastCheck, releaseId, serverVersion } = this;
7 log.debug("PersistentState: ", { lastCheck, releaseId, serverVersion });
11 * Used to check for *nightly* updates once an hour.
13 get lastCheck(): number | undefined {
14 return this.globalState.get("lastCheck");
16 async updateLastCheck(value: number) {
17 await this.globalState.update("lastCheck", value);
21 * Release id of the *nightly* extension.
22 * Used to check if we should update.
24 get releaseId(): number | undefined {
25 return this.globalState.get("releaseId");
27 async updateReleaseId(value: number) {
28 await this.globalState.update("releaseId", value);
32 * Version of the extension that installed the server.
33 * Used to check if we need to update the server.
35 get serverVersion(): string | undefined {
36 return this.globalState.get("serverVersion");
38 async updateServerVersion(value: string | undefined) {
39 await this.globalState.update("serverVersion", value);