mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 11:38:51 +01:00
Extension: Make open extension a service
This commit is contained in:
@@ -116,7 +116,7 @@ export class ExtensionsViewlet extends Viewlet implements IExtensionsViewlet {
|
||||
chain(this.list.onSelectionChange)
|
||||
.map(e => e.elements[0])
|
||||
.filter(e => !!e)
|
||||
.on(this.openExtension, this, this.disposables);
|
||||
.on(this.extensionsWorkbenchService.open, this, this.disposables);
|
||||
|
||||
return TPromise.as(null);
|
||||
}
|
||||
@@ -296,11 +296,6 @@ export class ExtensionsViewlet extends Viewlet implements IExtensionsViewlet {
|
||||
.then(result => new PagedModel(result));
|
||||
}
|
||||
|
||||
private openExtension(extension: IExtension): void {
|
||||
this.editorService.openEditor(this.instantiationService.createInstance(ExtensionsInput, extension))
|
||||
.done(null, err => this.onError(err));
|
||||
}
|
||||
|
||||
private onEnter(): void {
|
||||
this.list.setSelection(...this.list.getFocus());
|
||||
}
|
||||
|
||||
@@ -368,6 +368,11 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
|
||||
});
|
||||
}
|
||||
|
||||
open(extension: IExtension): void {
|
||||
this.editorService.openEditor(this.instantiationService.createInstance(ExtensionsInput, extension))
|
||||
.done(null, err => this.onError(err));
|
||||
}
|
||||
|
||||
private fromGallery(gallery: IGalleryExtension): Extension {
|
||||
const installedByGalleryId = index(this.installed, e => e.local.metadata ? e.local.metadata.id : '');
|
||||
const id = gallery.id;
|
||||
@@ -620,15 +625,10 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
|
||||
}
|
||||
|
||||
const extension = result.firstPage[0];
|
||||
this.openExtension(extension);
|
||||
this.open(extension);
|
||||
});
|
||||
}
|
||||
|
||||
private openExtension(extension: IExtension): void {
|
||||
this.editorService.openEditor(this.instantiationService.createInstance(ExtensionsInput, extension))
|
||||
.done(null, err => this.onError(err));
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this.disposables = dispose(this.disposables);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user