Merge VS Code 1.31.1 (#4283)

This commit is contained in:
Matt Irvine
2019-03-15 13:09:45 -07:00
committed by GitHub
parent 7d31575149
commit 86bac90001
1716 changed files with 53308 additions and 48375 deletions

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { mapEvent, fromNodeEventEmitter, filterEvent, once } from 'vs/base/common/event';
import { Event } from 'vs/base/common/event';
import { IURLService } from 'vs/platform/url/common/url';
import product from 'vs/platform/node/product';
import { app } from 'electron';
@@ -11,6 +11,7 @@ import { URI } from 'vs/base/common/uri';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IWindowsMainService } from 'vs/platform/windows/electron-main/windows';
import { isWindows } from 'vs/base/common/platform';
import { coalesce } from 'vs/base/common/arrays';
function uriFromRawUrl(url: string): URI | null {
try {
@@ -26,7 +27,7 @@ export class ElectronURLListener {
constructor(
initial: string | string[],
@IURLService private urlService: IURLService,
@IURLService private readonly urlService: IURLService,
@IWindowsMainService windowsService: IWindowsMainService
) {
const globalBuffer = ((<any>global).getOpenUrls() || []) as string[];
@@ -35,7 +36,7 @@ export class ElectronURLListener {
...globalBuffer
];
const buffer = rawBuffer.map(uriFromRawUrl).filter(uri => !!uri);
const buffer = coalesce(rawBuffer.map(uriFromRawUrl));
const flush = () => buffer.forEach(uri => {
if (uri) {
urlService.open(uri);
@@ -46,15 +47,15 @@ export class ElectronURLListener {
app.setAsDefaultProtocolClient(product.urlProtocol, process.execPath, ['--open-url', '--']);
}
const onOpenElectronUrl = mapEvent(
fromNodeEventEmitter(app, 'open-url', (event: Electron.Event, url: string) => ({ event, url })),
const onOpenElectronUrl = Event.map(
Event.fromNodeEventEmitter(app, 'open-url', (event: Electron.Event, url: string) => ({ event, url })),
({ event, url }) => {
// always prevent default and return the url as string
event.preventDefault();
return url;
});
const onOpenUrl = filterEvent(mapEvent(onOpenElectronUrl, uriFromRawUrl), uri => !!uri);
const onOpenUrl = Event.filter(Event.map(onOpenElectronUrl, uriFromRawUrl), uri => !!uri);
onOpenUrl(this.urlService.open, this.urlService, this.disposables);
const isWindowReady = windowsService.getWindows()
@@ -64,7 +65,7 @@ export class ElectronURLListener {
if (isWindowReady) {
flush();
} else {
once(windowsService.onWindowReady)(flush);
Event.once(windowsService.onWindowReady)(flush);
}
}