Adopt latest editor & new npm deps

This commit is contained in:
Alex Dima 2018-11-12 17:14:18 +01:00
parent 6653d96ddd
commit 527c95f016
5 changed files with 65 additions and 139 deletions

View file

@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {LanguageServiceDefaultsImpl} from './monaco.contribution';
import {JSONWorker} from './jsonWorker';
import { LanguageServiceDefaultsImpl } from './monaco.contribution';
import { JSONWorker } from './jsonWorker';
import Promise = monaco.Promise;
import IDisposable = monaco.IDisposable;
@ -82,26 +82,10 @@ export class WorkerManager {
getLanguageServiceWorker(...resources: Uri[]): Promise<JSONWorker> {
let _client: JSONWorker;
return toShallowCancelPromise(
this._getClient().then((client) => {
_client = client
}).then(_ => {
return this._worker.withSyncedResources(resources)
}).then(_ => _client)
);
return this._getClient().then((client) => {
_client = client
}).then(_ => {
return this._worker.withSyncedResources(resources)
}).then(_ => _client);
}
}
function toShallowCancelPromise<T>(p: Promise<T>): Promise<T> {
let completeCallback: (value: T) => void;
let errorCallback: (err: any) => void;
let r = new Promise<T>((c, e) => {
completeCallback = c;
errorCallback = e;
}, () => { });
p.then(completeCallback, errorCallback);
return r;
}