Adopt latest editor & new npm deps

This commit is contained in:
Alex Dima 2018-11-12 16:59:07 +01:00
parent 1d4b425215
commit f6d638686b
4 changed files with 61 additions and 86 deletions

View file

@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {LanguageServiceDefaultsImpl} from './monaco.contribution';
import {CSSWorker} from './cssWorker';
import { LanguageServiceDefaultsImpl } from './monaco.contribution';
import { CSSWorker } from './cssWorker';
import Promise = monaco.Promise;
import IDisposable = monaco.IDisposable;
@ -81,26 +81,10 @@ export class WorkerManager {
getLanguageServiceWorker(...resources: Uri[]): Promise<CSSWorker> {
let _client: CSSWorker;
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;
}