Strict checks for json

This commit is contained in:
Alex Dima 2021-11-13 21:33:03 +01:00
parent 6054aa23fc
commit 45ae1272ea
No known key found for this signature in database
GPG key ID: 39563C1504FDD0C9
6 changed files with 85 additions and 47 deletions

View file

@ -15,12 +15,13 @@ export class WorkerManager {
private _lastUsedTime: number;
private _configChangeListener: IDisposable;
private _worker: editor.MonacoWebWorker<JSONWorker>;
private _client: Promise<JSONWorker>;
private _worker: editor.MonacoWebWorker<JSONWorker> | null;
private _client: Promise<JSONWorker> | null;
constructor(defaults: LanguageServiceDefaults) {
this._defaults = defaults;
this._worker = null;
this._client = null;
this._idleCheckInterval = window.setInterval(() => this._checkIfIdle(), 30 * 1000);
this._lastUsedTime = 0;
this._configChangeListener = this._defaults.onDidChange(() => this._stopWorker());
@ -81,7 +82,9 @@ export class WorkerManager {
_client = client;
})
.then((_) => {
return this._worker.withSyncedResources(resources);
if (this._worker) {
return this._worker.withSyncedResources(resources);
}
})
.then((_) => _client);
}