in package/src/workerManager.ts [74:111]
private _getClient(): Promise<WorkerDetails> {
// Since onDidProvideCompletionItems is not used in web worker, and since functions cannot be trivially serialized (throws exception unable to clone), We remove it here.
const { onDidProvideCompletionItems, ...languageSettings } = this._defaults.languageSettings;
if (!this._workerDetailsPromise) {
const worker = this._monacoInstance.editor.createWebWorker<IKustoWorkerImpl>({
// module that exports the create() method and returns a `KustoWorker` instance
moduleId: 'vs/language/kusto/kustoWorker',
label: 'kusto',
// passed in to the create() method
createData: {
languageSettings: languageSettings,
languageId: 'kusto',
},
});
const client = worker.getProxy().then((proxy) => {
// push state we held onto before killing the client.
if (this._storedState) {
return proxy.setSchema(this._storedState.schema).then(() => proxy);
} else {
return proxy;
}
});
this._workerDetailsPromise = client.then((client) => {
this._workerDetails = {
_worker: worker,
_client: client,
_lastUsedTime: Date.now(),
};
return this._workerDetails;
});
}
return this._workerDetailsPromise;
}