提交 30176fff 编写于 作者: J Joao Moreno

open extension url when all windows are closed

fixes #27343
上级 7f2c7be6
......@@ -37,10 +37,17 @@ export class WindowsService implements IWindowsService, IDisposable {
@ILifecycleService private lifecycleService: ILifecycleService,
@IHistoryMainService private historyService: IHistoryMainService
) {
// Catch file URLs
chain(urlService.onOpenURL)
.filter(uri => uri.authority === 'file' && !!uri.path)
.map(uri => URI.file(uri.fsPath))
.on(this.openFileForURI, this, this.disposables);
// Catch extension URLs when there are no windows open
chain(urlService.onOpenURL)
.filter(uri => /^extension/.test(uri.path))
.filter(() => this.windowsMainService.getWindowCount() === 0)
.on(this.openExtensionForURI, this, this.disposables);
}
openFileFolderPicker(windowId: number, forceNewWindow?: boolean, data?: ITelemetryData): TPromise<void> {
......@@ -315,6 +322,16 @@ export class WindowsService implements IWindowsService, IDisposable {
return TPromise.as(null);
}
/**
* This should only fire whenever an extension URL is open
* and there are no windows to handle it.
*/
private openExtensionForURI(uri: URI): TPromise<void> {
const cli = assign(Object.create(null), this.environmentService.args);
this.windowsMainService.open({ context: OpenContext.API, cli });
return TPromise.as(null);
}
dispose(): void {
this.disposables = dispose(this.disposables);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册