diff options
Diffstat (limited to 'editors/code/src/config.ts')
-rw-r--r-- | editors/code/src/config.ts | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index f63e1d20e..bd8096dd6 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts | |||
@@ -182,13 +182,6 @@ export class Config { | |||
182 | return this.createGithubReleaseSource("rust-analyzer.vsix", NIGHTLY_TAG); | 182 | return this.createGithubReleaseSource("rust-analyzer.vsix", NIGHTLY_TAG); |
183 | } | 183 | } |
184 | 184 | ||
185 | readonly installedNightlyExtensionReleaseDate = new DateStorage( | ||
186 | "installed-nightly-extension-release-date", | ||
187 | this.ctx.globalState | ||
188 | ); | ||
189 | readonly serverReleaseDate = new DateStorage("server-release-date", this.ctx.globalState); | ||
190 | readonly serverReleaseTag = new Storage<null | string>("server-release-tag", this.ctx.globalState, null); | ||
191 | |||
192 | // We don't do runtime config validation here for simplicity. More on stackoverflow: | 185 | // We don't do runtime config validation here for simplicity. More on stackoverflow: |
193 | // https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension | 186 | // https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension |
194 | 187 | ||
@@ -232,37 +225,3 @@ export class Config { | |||
232 | // for internal use | 225 | // for internal use |
233 | get withSysroot() { return this.cfg.get("withSysroot", true) as boolean; } | 226 | get withSysroot() { return this.cfg.get("withSysroot", true) as boolean; } |
234 | } | 227 | } |
235 | |||
236 | export class Storage<T> { | ||
237 | constructor( | ||
238 | private readonly key: string, | ||
239 | private readonly storage: vscode.Memento, | ||
240 | private readonly defaultVal: T | ||
241 | ) { } | ||
242 | |||
243 | get(): T { | ||
244 | const val = this.storage.get(this.key, this.defaultVal); | ||
245 | log.debug(this.key, "==", val); | ||
246 | return val; | ||
247 | } | ||
248 | async set(val: T) { | ||
249 | log.debug(this.key, "=", val); | ||
250 | await this.storage.update(this.key, val); | ||
251 | } | ||
252 | } | ||
253 | export class DateStorage { | ||
254 | inner: Storage<null | string>; | ||
255 | |||
256 | constructor(key: string, storage: vscode.Memento) { | ||
257 | this.inner = new Storage(key, storage, null); | ||
258 | } | ||
259 | |||
260 | get(): null | Date { | ||
261 | const dateStr = this.inner.get(); | ||
262 | return dateStr ? new Date(dateStr) : null; | ||
263 | } | ||
264 | |||
265 | async set(date: null | Date) { | ||
266 | await this.inner.set(date ? date.toString() : null); | ||
267 | } | ||
268 | } | ||