Merge from vscode fc10e26ea50f82cdd84e9141491357922e6f5fba (#4639)

This commit is contained in:
Anthony Dresser
2019-03-21 10:58:16 -07:00
committed by GitHub
parent 8298db7d13
commit b65ee5b42e
149 changed files with 1408 additions and 814 deletions

View File

@@ -84,7 +84,7 @@ export class GalleryExtensionsHandler extends QuickOpenHandler {
getResults(text: string, token: CancellationToken): Promise<IModel<any>> {
if (/\./.test(text)) {
return this.galleryService.query({ names: [text], pageSize: 1 })
return this.galleryService.query({ names: [text], pageSize: 1 }, token)
.then(galleryResult => {
const entries: SimpleEntry[] = [];
const galleryExtension = galleryResult.firstPage[0];

View File

@@ -85,7 +85,8 @@ export interface IExtensionsWorkbenchService {
onChange: Event<IExtension | undefined>;
local: IExtension[];
queryLocal(): Promise<IExtension[]>;
queryGallery(options?: IQueryOptions): Promise<IPager<IExtension>>;
queryGallery(token: CancellationToken): Promise<IPager<IExtension>>;
queryGallery(options: IQueryOptions, token: CancellationToken): Promise<IPager<IExtension>>;
canInstall(extension: IExtension): boolean;
install(vsix: string): Promise<IExtension>;
install(extension: IExtension, promptToInstallDependencies?: boolean): Promise<IExtension>;

View File

@@ -739,7 +739,7 @@ export class ExtensionEditor extends BaseEditor {
getChildren(): Promise<IExtensionData[] | null> {
if (this.hasChildren) {
const names = arrays.distinct(this.extension.extensionPack, e => e.toLowerCase());
return extensionsWorkbenchService.queryGallery({ names, pageSize: names.length })
return extensionsWorkbenchService.queryGallery({ names, pageSize: names.length }, CancellationToken.None)
.then(result => result.firstPage.map(extension => new ExtensionData(extension, this)));
}
return Promise.resolve(null);

View File

@@ -387,7 +387,7 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe
if (filteredWanted.length) {
try {
let validRecommendations = (await this._galleryService.query({ names: filteredWanted, pageSize: filteredWanted.length })).firstPage
let validRecommendations = (await this._galleryService.query({ names: filteredWanted, pageSize: filteredWanted.length }, CancellationToken.None)).firstPage
.map(extension => extension.identifier.id.toLowerCase());
if (validRecommendations.length !== filteredWanted.length) {
@@ -776,7 +776,7 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe
const lookup = product.extensionKeywords || {};
const keywords = lookup[fileExtension] || [];
this._galleryService.query({ text: `tag:"__ext_${fileExtension}" ${keywords.map(tag => `tag:"${tag}"`)}` }).then(pager => {
this._galleryService.query({ text: `tag:"__ext_${fileExtension}" ${keywords.map(tag => `tag:"${tag}"`)}` }, CancellationToken.None).then(pager => {
if (!pager || !pager.firstPage || !pager.firstPage.length) {
return;
}

View File

@@ -49,6 +49,7 @@ import { ExtensionActivationProgress } from 'vs/workbench/contrib/extensions/ele
import { ExtensionsAutoProfiler } from 'vs/workbench/contrib/extensions/electron-browser/extensionsAutoProfiler';
import { onUnexpectedError } from 'vs/base/common/errors';
import { ExtensionDependencyChecker } from 'vs/workbench/contrib/extensions/electron-browser/extensionsDependencyChecker';
import { CancellationToken } from 'vs/base/common/cancellation';
// Singletons
registerSingleton(IExtensionsWorkbenchService, ExtensionsWorkbenchService);
@@ -268,7 +269,7 @@ CommandsRegistry.registerCommand('_extensions.manage', (accessor: ServicesAccess
CommandsRegistry.registerCommand('extension.open', (accessor: ServicesAccessor, extensionId: string) => {
const extensionService = accessor.get(IExtensionsWorkbenchService);
return extensionService.queryGallery({ names: [extensionId], pageSize: 1 }).then(pager => {
return extensionService.queryGallery({ names: [extensionId], pageSize: 1 }, CancellationToken.None).then(pager => {
if (pager.total !== 1) {
return;
}

View File

@@ -1538,7 +1538,7 @@ export class InstallWorkspaceRecommendedExtensionsAction extends Action {
viewlet.search('@recommended ');
viewlet.focus();
const names = this.recommendations.map(({ extensionId }) => extensionId);
return this.extensionWorkbenchService.queryGallery({ names, source: 'install-all-workspace-recommendations' }).then(pager => {
return this.extensionWorkbenchService.queryGallery({ names, source: 'install-all-workspace-recommendations' }, CancellationToken.None).then(pager => {
let installPromises: Promise<any>[] = [];
let model = new PagedModel(pager);
for (let i = 0; i < pager.total; i++) {
@@ -1580,7 +1580,7 @@ export class InstallRecommendedExtensionAction extends Action {
.then(viewlet => {
viewlet.search('@recommended ');
viewlet.focus();
return this.extensionWorkbenchService.queryGallery({ names: [this.extensionId], source: 'install-recommendation', pageSize: 1 })
return this.extensionWorkbenchService.queryGallery({ names: [this.extensionId], source: 'install-recommendation', pageSize: 1 }, CancellationToken.None)
.then(pager => {
if (pager && pager.firstPage && pager.firstPage.length) {
const extension = pager.firstPage[0];

View File

@@ -15,6 +15,7 @@ import { INotificationService, Severity } from 'vs/platform/notification/common/
import { Action } from 'vs/base/common/actions';
import { IWindowService } from 'vs/platform/windows/common/windows';
import { Disposable } from 'vs/base/common/lifecycle';
import { CancellationToken } from 'vs/base/common/cancellation';
export class ExtensionDependencyChecker extends Disposable implements IWorkbenchContribution {
@@ -60,7 +61,7 @@ export class ExtensionDependencyChecker extends Disposable implements IWorkbench
private async installMissingDependencies(): Promise<void> {
const missingDependencies = await this.getUninstalledMissingDependencies();
if (missingDependencies.length) {
const extensions = (await this.extensionsWorkbenchService.queryGallery({ names: missingDependencies, pageSize: missingDependencies.length })).firstPage;
const extensions = (await this.extensionsWorkbenchService.queryGallery({ names: missingDependencies, pageSize: missingDependencies.length }, CancellationToken.None)).firstPage;
if (extensions.length) {
await Promise.all(extensions.map(extension => this.extensionsWorkbenchService.install(extension)));
this.notificationService.notify({

View File

@@ -5,7 +5,7 @@
import 'vs/css!./media/extensionsViewlet';
import { localize } from 'vs/nls';
import { ThrottledDelayer, timeout } from 'vs/base/common/async';
import { timeout, Delayer } from 'vs/base/common/async';
import { isPromiseCanceledError } from 'vs/base/common/errors';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
@@ -271,7 +271,7 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio
private recommendedExtensionsContextKey: IContextKey<boolean>;
private defaultRecommendedExtensionsContextKey: IContextKey<boolean>;
private searchDelayer: ThrottledDelayer<any>;
private searchDelayer: Delayer<void>;
private root: HTMLElement;
private searchBox: SuggestEnabledInput;
@@ -300,7 +300,7 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio
) {
super(VIEWLET_ID, `${VIEWLET_ID}.state`, true, configurationService, layoutService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
this.searchDelayer = new ThrottledDelayer(500);
this.searchDelayer = new Delayer(500);
this.nonEmptyWorkspaceContextKey = NonEmptyWorkspaceContext.bindTo(contextKeyService);
this.searchExtensionsContextKey = SearchExtensionsContext.bindTo(contextKeyService);
this.hasInstalledExtensionsContextKey = HasInstalledExtensionsContext.bindTo(contextKeyService);

View File

@@ -44,6 +44,7 @@ import { IAction } from 'vs/base/common/actions';
import { ExtensionType } from 'vs/platform/extensions/common/extensions';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import product from 'vs/platform/product/node/product';
import { CancelablePromise, createCancelablePromise } from 'vs/base/common/async';
class ExtensionsViewState extends Disposable implements IExtensionsViewState {
@@ -69,6 +70,7 @@ export class ExtensionsListView extends ViewletPanel {
private badge: CountBadge;
protected badgeContainer: HTMLElement;
private list: WorkbenchPagedList<IExtension> | null;
private queryRequest: { query: string, request: CancelablePromise<IPagedModel<IExtension>> } | null;
constructor(
private options: IViewletViewOptions,
@@ -139,6 +141,14 @@ export class ExtensionsListView extends ViewletPanel {
}
async show(query: string): Promise<IPagedModel<IExtension>> {
if (this.queryRequest) {
if (this.queryRequest.query === query) {
return this.queryRequest.request;
}
this.queryRequest.request.cancel();
this.queryRequest = null;
}
const parsedQuery = Query.parse(query);
let options: IQueryOptions = {
@@ -152,21 +162,24 @@ export class ExtensionsListView extends ViewletPanel {
}
const successCallback = model => {
this.queryRequest = null;
this.setModel(model);
return model;
};
const errorCallback = e => {
console.warn('Error querying extensions gallery', e);
const model = new PagedModel([]);
this.setModel(model, true);
return model;
if (!isPromiseCanceledError(e)) {
this.queryRequest = null;
console.warn('Error querying extensions gallery', e);
this.setModel(model, true);
}
return this.list ? this.list.model : model;
};
if (ExtensionsListView.isInstalledExtensionsQuery(query) || /@builtin/.test(query)) {
return await this.queryLocal(parsedQuery, options).then(successCallback).catch(errorCallback);
}
return await this.queryGallery(parsedQuery, options).then(successCallback).catch(errorCallback);
const isLocalQuery = ExtensionsListView.isInstalledExtensionsQuery(query) || /@builtin/.test(query);
const request = createCancelablePromise(token => (isLocalQuery ? this.queryLocal(parsedQuery, options) : this.queryGallery(parsedQuery, options, token)).then(successCallback).catch(errorCallback));
this.queryRequest = { query, request };
return request.then(successCallback).catch(errorCallback);
}
count(): number {
@@ -326,7 +339,7 @@ export class ExtensionsListView extends ViewletPanel {
return new PagedModel([]);
}
private async queryGallery(query: Query, options: IQueryOptions): Promise<IPagedModel<IExtension>> {
private async queryGallery(query: Query, options: IQueryOptions, token: CancellationToken): Promise<IPagedModel<IExtension>> {
const hasUserDefinedSortOrder = options.sortBy !== undefined;
if (!hasUserDefinedSortOrder && !query.value.trim()) {
options.sortBy = SortBy.InstallCount;
@@ -343,25 +356,25 @@ export class ExtensionsListView extends ViewletPanel {
}
if (names.length) {
return this.extensionsWorkbenchService.queryGallery({ names, source: 'queryById' })
return this.extensionsWorkbenchService.queryGallery({ names, source: 'queryById' }, token)
.then(pager => this.getPagedModel(pager));
}
if (ExtensionsListView.isWorkspaceRecommendedExtensionsQuery(query.value)) {
return this.getWorkspaceRecommendationsModel(query, options);
return this.getWorkspaceRecommendationsModel(query, options, token);
} else if (ExtensionsListView.isKeymapsRecommendedExtensionsQuery(query.value)) {
return this.getKeymapRecommendationsModel(query, options);
return this.getKeymapRecommendationsModel(query, options, token);
} else if (/@recommended:all/i.test(query.value) || ExtensionsListView.isSearchRecommendedExtensionsQuery(query.value)) {
return this.getAllRecommendationsModel(query, options);
return this.getAllRecommendationsModel(query, options, token);
} else if (ExtensionsListView.isRecommendedExtensionsQuery(query.value)) {
return this.getRecommendationsModel(query, options);
return this.getRecommendationsModel(query, options, token);
// {{SQL CARBON EDIT}}
} else if (ExtensionsListView.isAllMarketplaceExtensionsQuery(query.value)) {
return this.getAllMarketplaceModel(query, options);
return this.getAllMarketplaceModel(query, options, token);
}
if (/\bcurated:([^\s]+)\b/.test(query.value)) {
return this.getCuratedModel(query, options);
return this.getCuratedModel(query, options, token);
}
let text = query.value;
@@ -385,7 +398,7 @@ export class ExtensionsListView extends ViewletPanel {
if (text !== query.value) {
options = assign(options, { text: text.substr(0, 350), source: 'file-extension-tags' });
return this.extensionsWorkbenchService.queryGallery(options).then(pager => this.getPagedModel(pager));
return this.extensionsWorkbenchService.queryGallery(options, token).then(pager => this.getPagedModel(pager));
}
}
@@ -406,7 +419,7 @@ export class ExtensionsListView extends ViewletPanel {
options.source = 'viewlet';
}
const pager = await this.extensionsWorkbenchService.queryGallery(options);
const pager = await this.extensionsWorkbenchService.queryGallery(options, token);
let positionToUpdate = 0;
for (const preferredResult of preferredResults) {
@@ -453,7 +466,7 @@ export class ExtensionsListView extends ViewletPanel {
}
// Get All types of recommendations, trimmed to show a max of 8 at any given time
private getAllRecommendationsModel(query: Query, options: IQueryOptions): Promise<IPagedModel<IExtension>> {
private getAllRecommendationsModel(query: Query, options: IQueryOptions, token: CancellationToken): Promise<IPagedModel<IExtension>> {
const value = query.value.replace(/@recommended:all/g, '').replace(/@recommended/g, '').trim().toLowerCase();
return this.extensionsWorkbenchService.queryLocal()
@@ -486,7 +499,7 @@ export class ExtensionsListView extends ViewletPanel {
return Promise.resolve(new PagedModel([]));
}
options.source = 'recommendations-all';
return this.extensionsWorkbenchService.queryGallery(assign(options, { names, pageSize: names.length }))
return this.extensionsWorkbenchService.queryGallery(assign(options, { names, pageSize: names.length }), token)
.then(pager => {
this.sortFirstPage(pager, names);
return this.getPagedModel(pager || []);
@@ -495,12 +508,12 @@ export class ExtensionsListView extends ViewletPanel {
});
}
private async getCuratedModel(query: Query, options: IQueryOptions): Promise<IPagedModel<IExtension>> {
private async getCuratedModel(query: Query, options: IQueryOptions, token: CancellationToken): Promise<IPagedModel<IExtension>> {
const value = query.value.replace(/curated:/g, '').trim();
const names = await this.experimentService.getCuratedExtensionsList(value);
if (Array.isArray(names) && names.length) {
options.source = `curated:${value}`;
const pager = await this.extensionsWorkbenchService.queryGallery(assign(options, { names, pageSize: names.length }));
const pager = await this.extensionsWorkbenchService.queryGallery(assign(options, { names, pageSize: names.length }), token);
this.sortFirstPage(pager, names);
return this.getPagedModel(pager || []);
}
@@ -508,7 +521,7 @@ export class ExtensionsListView extends ViewletPanel {
}
// Get All types of recommendations other than Workspace recommendations, trimmed to show a max of 8 at any given time
private getRecommendationsModel(query: Query, options: IQueryOptions): Promise<IPagedModel<IExtension>> {
private getRecommendationsModel(query: Query, options: IQueryOptions, token: CancellationToken): Promise<IPagedModel<IExtension>> {
const value = query.value.replace(/@recommended/g, '').trim().toLowerCase();
return this.extensionsWorkbenchService.queryLocal()
@@ -546,7 +559,7 @@ export class ExtensionsListView extends ViewletPanel {
return Promise.resolve(new PagedModel([]));
}
options.source = 'recommendations';
return this.extensionsWorkbenchService.queryGallery(assign(options, { names, pageSize: names.length }))
return this.extensionsWorkbenchService.queryGallery(assign(options, { names, pageSize: names.length }), token)
.then(pager => {
this.sortFirstPage(pager, names);
return this.getPagedModel(pager || []);
@@ -556,7 +569,7 @@ export class ExtensionsListView extends ViewletPanel {
}
// {{SQL CARBON EDIT}}
private getAllMarketplaceModel(query: Query, options: IQueryOptions): Promise<IPagedModel<IExtension>> {
private getAllMarketplaceModel(query: Query, options: IQueryOptions, token: CancellationToken): Promise<IPagedModel<IExtension>> {
const value = query.value.trim().toLowerCase();
return this.extensionsWorkbenchService.queryLocal()
.then(result => result.filter(e => e.type === ExtensionType.User))
@@ -564,7 +577,7 @@ export class ExtensionsListView extends ViewletPanel {
return this.tipsService.getOtherRecommendations().then((recommmended) => {
const installedExtensions = local.map(x => `${x.publisher}.${x.name}`);
options = assign(options, { text: value, source: 'searchText' });
return this.extensionsWorkbenchService.queryGallery(options).then((pager) => {
return this.extensionsWorkbenchService.queryGallery(options, token).then((pager) => {
// filter out installed extensions
pager.firstPage = pager.firstPage.filter((p) => {
return installedExtensions.indexOf(`${p.publisher}.${p.name}`) === -1;
@@ -624,7 +637,7 @@ export class ExtensionsListView extends ViewletPanel {
return installed.some(i => areSameExtensions(i.identifier, { id: recommendation.extensionId }));
}
private getWorkspaceRecommendationsModel(query: Query, options: IQueryOptions): Promise<IPagedModel<IExtension>> {
private getWorkspaceRecommendationsModel(query: Query, options: IQueryOptions, token: CancellationToken): Promise<IPagedModel<IExtension>> {
const value = query.value.replace(/@recommended:workspace/g, '').trim().toLowerCase();
return this.tipsService.getWorkspaceRecommendations()
.then(recommendations => {
@@ -640,12 +653,12 @@ export class ExtensionsListView extends ViewletPanel {
return Promise.resolve(new PagedModel([]));
}
options.source = 'recommendations-workspace';
return this.extensionsWorkbenchService.queryGallery(assign(options, { names, pageSize: names.length }))
return this.extensionsWorkbenchService.queryGallery(assign(options, { names, pageSize: names.length }), token)
.then(pager => this.getPagedModel(pager || []));
});
}
private getKeymapRecommendationsModel(query: Query, options: IQueryOptions): Promise<IPagedModel<IExtension>> {
private getKeymapRecommendationsModel(query: Query, options: IQueryOptions, token: CancellationToken): Promise<IPagedModel<IExtension>> {
const value = query.value.replace(/@recommended:keymaps/g, '').trim().toLowerCase();
const names: string[] = this.tipsService.getKeymapRecommendations().map(({ extensionId }) => extensionId)
.filter(extensionId => extensionId.toLowerCase().indexOf(value) > -1);
@@ -654,7 +667,7 @@ export class ExtensionsListView extends ViewletPanel {
return Promise.resolve(new PagedModel([]));
}
options.source = 'recommendations-keymaps';
return this.extensionsWorkbenchService.queryGallery(assign(options, { names, pageSize: names.length }))
return this.extensionsWorkbenchService.queryGallery(assign(options, { names, pageSize: names.length }), token)
.then(result => this.getPagedModel(result));
}
@@ -735,6 +748,10 @@ export class ExtensionsListView extends ViewletPanel {
dispose(): void {
super.dispose();
if (this.queryRequest) {
this.queryRequest.request.cancel();
this.queryRequest = null;
}
this.disposables = dispose(this.disposables);
this.list = null;
}

View File

@@ -463,12 +463,16 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
});
}
queryGallery(options: IQueryOptions = {}): Promise<IPager<IExtension>> {
queryGallery(token: CancellationToken): Promise<IPager<IExtension>>;
queryGallery(options: IQueryOptions, token: CancellationToken): Promise<IPager<IExtension>>;
queryGallery(arg1: any, arg2?: any): Promise<IPager<IExtension>> {
const options: IQueryOptions = CancellationToken.isCancellationToken(arg1) ? {} : arg1;
const token: CancellationToken = CancellationToken.isCancellationToken(arg1) ? arg1 : arg2;
return this.extensionService.getExtensionsReport()
.then(report => {
const maliciousSet = getMaliciousExtensionsSet(report);
return this.galleryService.query(options)
return this.galleryService.query(options, token)
.then(result => mapPager(result, gallery => this.fromGallery(gallery, maliciousSet)))
.then(undefined, err => {
if (/No extension gallery service configured/.test(err.message)) {
@@ -610,10 +614,10 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
const promises: Promise<IPager<IExtension>>[] = [];
if (ids.length) {
promises.push(this.queryGallery({ ids, pageSize: ids.length }));
promises.push(this.queryGallery({ ids, pageSize: ids.length }, CancellationToken.None));
}
if (names.length) {
promises.push(this.queryGallery({ names, pageSize: names.length }));
promises.push(this.queryGallery({ names, pageSize: names.length }, CancellationToken.None));
}
return Promise.all(promises).then(() => undefined);
@@ -1056,7 +1060,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
.then(() => this.open(extension));
}
return this.queryGallery({ names: [extensionId], source: 'uri' }).then(result => {
return this.queryGallery({ names: [extensionId], source: 'uri' }, CancellationToken.None).then(result => {
if (result.total < 1) {
return Promise.resolve(null);
}

View File

@@ -38,6 +38,7 @@ import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteA
import { RemoteAgentService } from 'vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl';
import { ExtensionIdentifier, IExtensionContributions, ExtensionType, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
import { CancellationToken } from 'vs/base/common/cancellation';
suite('ExtensionsActions Test', () => {
@@ -110,7 +111,7 @@ suite('ExtensionsActions Test', () => {
return workbenchService.queryLocal()
.then(() => {
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(aGalleryExtension('a', { identifier: local.identifier })));
return workbenchService.queryGallery()
return workbenchService.queryGallery(CancellationToken.None)
.then((paged) => {
testObject.extension = paged.firstPage[0];
assert.ok(!testObject.enabled);
@@ -126,7 +127,7 @@ suite('ExtensionsActions Test', () => {
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
const gallery = aGalleryExtension('a');
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
return workbenchService.queryGallery()
return workbenchService.queryGallery(CancellationToken.None)
.then((paged) => {
testObject.extension = paged.firstPage[0];
installEvent.fire({ identifier: gallery.identifier, gallery });
@@ -143,7 +144,7 @@ suite('ExtensionsActions Test', () => {
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
const gallery = aGalleryExtension('a');
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
return workbenchService.queryGallery()
return workbenchService.queryGallery(CancellationToken.None)
.then((paged) => {
testObject.extension = paged.firstPage[0];
assert.ok(testObject.enabled);
@@ -257,7 +258,7 @@ suite('ExtensionsActions Test', () => {
const gallery = aGalleryExtension('a');
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
.then(paged => {
testObject.extension = paged.firstPage[0];
@@ -299,7 +300,7 @@ suite('ExtensionsActions Test', () => {
const gallery = aGalleryExtension('a');
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
return workbenchService.queryGallery()
return workbenchService.queryGallery(CancellationToken.None)
.then((paged) => {
testObject.extension = paged.firstPage[0];
assert.ok(testObject.enabled);
@@ -329,7 +330,7 @@ suite('ExtensionsActions Test', () => {
const workbenchService = instantiationService.get(IExtensionsWorkbenchService);
const gallery = aGalleryExtension('a');
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
return workbenchService.queryGallery()
return workbenchService.queryGallery(CancellationToken.None)
.then((paged) => {
testObject.extension = paged.firstPage[0];
installEvent.fire({ identifier: gallery.identifier, gallery });
@@ -387,7 +388,7 @@ suite('ExtensionsActions Test', () => {
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
const gallery = aGalleryExtension('a', { version: '1.0.0' });
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
.then((paged) => {
testObject.extension = paged.firstPage[0];
assert.ok(!testObject.enabled);
@@ -404,7 +405,7 @@ suite('ExtensionsActions Test', () => {
.then(extensions => {
testObject.extension = extensions[0];
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(aGalleryExtension('a', { identifier: local.identifier, version: local.manifest.version })));
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
.then(extensions => assert.ok(!testObject.enabled));
});
});
@@ -419,7 +420,7 @@ suite('ExtensionsActions Test', () => {
.then(extensions => {
testObject.extension = extensions[0];
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(aGalleryExtension('a', { identifier: local.identifier, version: '1.0.1' })));
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
.then(extensions => assert.ok(!testObject.enabled));
});
});
@@ -442,7 +443,7 @@ suite('ExtensionsActions Test', () => {
c();
}
});
instantiationService.get(IExtensionsWorkbenchService).queryGallery();
instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None);
});
});
});
@@ -458,7 +459,7 @@ suite('ExtensionsActions Test', () => {
testObject.extension = extensions[0];
const gallery = aGalleryExtension('a', { identifier: local.identifier, version: '1.0.1' });
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
.then(extensions => {
installEvent.fire({ identifier: local.identifier, gallery });
assert.ok(!testObject.enabled);
@@ -494,7 +495,7 @@ suite('ExtensionsActions Test', () => {
const gallery = aGalleryExtension('a');
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
.then(page => {
testObject.extension = page.firstPage[0];
assert.ok(!testObject.enabled);
@@ -509,7 +510,7 @@ suite('ExtensionsActions Test', () => {
const gallery = aGalleryExtension('a');
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
.then(page => {
testObject.extension = page.firstPage[0];
@@ -526,7 +527,7 @@ suite('ExtensionsActions Test', () => {
const gallery = aGalleryExtension('a');
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
.then(page => {
testObject.extension = page.firstPage[0];
installEvent.fire({ identifier: gallery.identifier, gallery });
@@ -750,7 +751,7 @@ suite('ExtensionsActions Test', () => {
const gallery = aGalleryExtension('a');
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
.then(page => {
const testObject: ExtensionsActions.EnableDropDownAction = instantiationService.createInstance(ExtensionsActions.EnableDropDownAction);
testObject.extension = page.firstPage[0];
@@ -762,7 +763,7 @@ suite('ExtensionsActions Test', () => {
const gallery = aGalleryExtension('a');
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
.then(page => {
const testObject: ExtensionsActions.EnableDropDownAction = instantiationService.createInstance(ExtensionsActions.EnableDropDownAction);
testObject.extension = page.firstPage[0];
@@ -934,7 +935,7 @@ suite('ExtensionsActions Test', () => {
const gallery = aGalleryExtension('a');
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
.then(page => {
const testObject: ExtensionsActions.DisableDropDownAction = instantiationService.createInstance(ExtensionsActions.DisableDropDownAction, [{ identifier: new ExtensionIdentifier('pub.a'), extensionLocation: URI.file('pub.a') }]);
testObject.extension = page.firstPage[0];
@@ -946,7 +947,7 @@ suite('ExtensionsActions Test', () => {
const gallery = aGalleryExtension('a');
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
.then(page => {
const testObject: ExtensionsActions.DisableDropDownAction = instantiationService.createInstance(ExtensionsActions.DisableDropDownAction, [{ identifier: new ExtensionIdentifier('pub.a'), extensionLocation: URI.file('pub.a') }]);
testObject.extension = page.firstPage[0];
@@ -998,7 +999,7 @@ suite('ExtensionsActions Test', () => {
c();
}
});
workbenchService.queryGallery();
workbenchService.queryGallery(CancellationToken.None);
});
});
});
@@ -1020,7 +1021,7 @@ suite('ExtensionsActions Test', () => {
c();
}
});
workbenchService.queryGallery();
workbenchService.queryGallery(CancellationToken.None);
});
});
});
@@ -1034,7 +1035,7 @@ suite('ExtensionsActions Test', () => {
return workbenchService.queryLocal()
.then(() => {
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(...gallery));
return workbenchService.queryGallery()
return workbenchService.queryGallery(CancellationToken.None)
.then(() => {
installEvent.fire({ identifier: local[0].identifier, gallery: gallery[0] });
installEvent.fire({ identifier: local[1].identifier, gallery: gallery[1] });
@@ -1056,7 +1057,7 @@ suite('ExtensionsActions Test', () => {
const workbenchService = instantiationService.get(IExtensionsWorkbenchService);
const gallery = aGalleryExtension('a');
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
return workbenchService.queryGallery()
return workbenchService.queryGallery(CancellationToken.None)
.then((paged) => {
testObject.extension = paged.firstPage[0];
installEvent.fire({ identifier: gallery.identifier, gallery });
@@ -1086,7 +1087,7 @@ suite('ExtensionsActions Test', () => {
const gallery = aGalleryExtension('a');
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
const paged = await instantiationService.get(IExtensionsWorkbenchService).queryGallery();
const paged = await instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None);
testObject.extension = paged.firstPage[0];
assert.ok(!testObject.enabled);
@@ -1108,7 +1109,7 @@ suite('ExtensionsActions Test', () => {
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
const gallery = aGalleryExtension('a');
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
.then((paged) => {
testObject.extension = paged.firstPage[0];
const identifier = gallery.identifier;
@@ -1320,7 +1321,7 @@ suite('ExtensionsActions Test', () => {
const gallery = aGalleryExtension('a');
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
const paged = await instantiationService.get(IExtensionsWorkbenchService).queryGallery();
const paged = await instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None);
testObject.extension = paged.firstPage[0];
assert.ok(!testObject.enabled);

View File

@@ -38,7 +38,7 @@ import { IExperimentService, ExperimentService, ExperimentState, ExperimentActio
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
import { RemoteAgentService } from 'vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl';
import { ExtensionManagementServerService } from 'vs/workbench/services/extensions/electron-browser/extensionManagementServerService';
import { ExtensionIdentifier, ExtensionType } from 'vs/platform/extensions/common/extensions';
import { ExtensionIdentifier, ExtensionType, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
@@ -124,13 +124,13 @@ suite('ExtensionsListView Tests', () => {
instantiationService.stubPromise(IExperimentService, 'getExperimentsByType', []);
instantiationService.stub(IExtensionService, {
getExtensions: () => {
getExtensions: (): Promise<IExtensionDescription[]> => {
return Promise.resolve([
{ identifier: new ExtensionIdentifier(localEnabledTheme.identifier.id) },
{ identifier: new ExtensionIdentifier(localEnabledLanguage.identifier.id) },
{ identifier: new ExtensionIdentifier(localRandom.identifier.id) },
{ identifier: new ExtensionIdentifier(builtInTheme.identifier.id) },
{ identifier: new ExtensionIdentifier(builtInBasic.identifier.id) }
toExtensionDescription(localEnabledTheme),
toExtensionDescription(localEnabledLanguage),
toExtensionDescription(localRandom),
toExtensionDescription(builtInTheme),
toExtensionDescription(builtInBasic)
]);
}
});
@@ -185,8 +185,8 @@ suite('ExtensionsListView Tests', () => {
});
});
test('Test installed query results', () => {
const allInstalledCheck = testableView.show('@installed').then(result => {
test('Test installed query results', async () => {
await testableView.show('@installed').then(result => {
assert.equal(result.length, 5, 'Unexpected number of results for @installed query');
const actual = [result.get(0).name, result.get(1).name, result.get(2).name, result.get(3).name, result.get(4).name].sort();
const expected = [localDisabledTheme.manifest.name, localEnabledTheme.manifest.name, localRandom.manifest.name, localDisabledLanguage.manifest.name, localEnabledLanguage.manifest.name];
@@ -195,125 +195,102 @@ suite('ExtensionsListView Tests', () => {
}
});
const installedCheck = testableView.show('@installed first').then(result => {
await testableView.show('@installed first').then(result => {
assert.equal(result.length, 2, 'Unexpected number of results for @installed query');
assert.equal(result.get(0).name, localDisabledTheme.manifest.name, 'Unexpected extension for @installed query with search text.');
assert.equal(result.get(1).name, localEnabledTheme.manifest.name, 'Unexpected extension for @installed query with search text.');
});
const allDisabledCheck = testableView.show('@disabled').then(result => {
await testableView.show('@disabled').then(result => {
assert.equal(result.length, 2, 'Unexpected number of results for @disabled query');
assert.equal(result.get(0).name, localDisabledTheme.manifest.name, 'Unexpected extension for @disabled query.');
assert.equal(result.get(1).name, localDisabledLanguage.manifest.name, 'Unexpected extension for @disabled query.');
});
const allEnabledCheck = testableView.show('@enabled').then(result => {
await testableView.show('@enabled').then(result => {
assert.equal(result.length, 3, 'Unexpected number of results for @enabled query');
assert.equal(result.get(0).name, localEnabledTheme.manifest.name, 'Unexpected extension for @enabled query.');
assert.equal(result.get(1).name, localRandom.manifest.name, 'Unexpected extension for @enabled query.');
assert.equal(result.get(2).name, localEnabledLanguage.manifest.name, 'Unexpected extension for @enabled query.');
});
const allBuiltinThemesCheck = testableView.show('@builtin:themes').then(result => {
await testableView.show('@builtin:themes').then(result => {
assert.equal(result.length, 1, 'Unexpected number of results for @builtin:themes query');
assert.equal(result.get(0).name, builtInTheme.manifest.name, 'Unexpected extension for @builtin:themes query.');
});
const allBuiltinBasicsCheck = testableView.show('@builtin:basics').then(result => {
await testableView.show('@builtin:basics').then(result => {
assert.equal(result.length, 1, 'Unexpected number of results for @builtin:basics query');
assert.equal(result.get(0).name, builtInBasic.manifest.name, 'Unexpected extension for @builtin:basics query.');
});
const allBuiltinCheck = testableView.show('@builtin').then(result => {
await testableView.show('@builtin').then(result => {
assert.equal(result.length, 2, 'Unexpected number of results for @builtin query');
assert.equal(result.get(0).name, builtInBasic.manifest.name, 'Unexpected extension for @builtin query.');
assert.equal(result.get(1).name, builtInTheme.manifest.name, 'Unexpected extension for @builtin query.');
});
const builtinCheck = testableView.show('@builtin my-theme').then(result => {
await testableView.show('@builtin my-theme').then(result => {
assert.equal(result.length, 1, 'Unexpected number of results for @builtin query');
assert.equal(result.get(0).name, builtInTheme.manifest.name, 'Unexpected extension for @builtin query.');
});
return Promise.all([
allInstalledCheck,
installedCheck,
allDisabledCheck,
allEnabledCheck,
allBuiltinThemesCheck,
allBuiltinBasicsCheck,
allBuiltinCheck,
builtinCheck]);
});
test('Test installed query with category', () => {
const installedCategoryWithoutQuotesCheck = testableView.show('@installed category:themes').then(result => {
test('Test installed query with category', async () => {
await testableView.show('@installed category:themes').then(result => {
assert.equal(result.length, 2, 'Unexpected number of results for @installed query with category');
assert.equal(result.get(0).name, localDisabledTheme.manifest.name, 'Unexpected extension for @installed query with category.');
assert.equal(result.get(1).name, localEnabledTheme.manifest.name, 'Unexpected extension for @installed query with category.');
});
const installedCategoryWithQuotesCheck = testableView.show('@installed category:"themes"').then(result => {
await testableView.show('@installed category:"themes"').then(result => {
assert.equal(result.length, 2, 'Unexpected number of results for @installed query with quoted category');
assert.equal(result.get(0).name, localDisabledTheme.manifest.name, 'Unexpected extension for @installed query with quoted category.');
assert.equal(result.get(1).name, localEnabledTheme.manifest.name, 'Unexpected extension for @installed query with quoted category.');
});
const installedCategoryWithSpaceCheck = testableView.show('@installed category:"programming languages"').then(result => {
await testableView.show('@installed category:"programming languages"').then(result => {
assert.equal(result.length, 2, 'Unexpected number of results for @installed query with quoted category including space');
assert.equal(result.get(0).name, localDisabledLanguage.manifest.name, 'Unexpected extension for @installed query with quoted category inlcuding space.');
assert.equal(result.get(1).name, localEnabledLanguage.manifest.name, 'Unexpected extension for @installed query with quoted category including space.');
});
const installedMultipleCategoryCheck = testableView.show('@installed category:themes category:random').then(result => {
await testableView.show('@installed category:themes category:random').then(result => {
assert.equal(result.length, 3, 'Unexpected number of results for @installed query with multiple category');
assert.equal(result.get(0).name, localDisabledTheme.manifest.name, 'Unexpected extension for @installed query with multiple category.');
assert.equal(result.get(1).name, localEnabledTheme.manifest.name, 'Unexpected extension for @installed query with multiple category.');
assert.equal(result.get(2).name, localRandom.manifest.name, 'Unexpected extension for @installed query with multiple category.');
});
const enabledCategoryWithoutQuotesCheck = testableView.show('@enabled category:themes').then(result => {
await testableView.show('@enabled category:themes').then(result => {
assert.equal(result.length, 1, 'Unexpected number of results for @enabled query with category');
assert.equal(result.get(0).name, localEnabledTheme.manifest.name, 'Unexpected extension for @enabled query with category.');
});
const enabledCategoryWithQuotesCheck = testableView.show('@enabled category:"themes"').then(result => {
await testableView.show('@enabled category:"themes"').then(result => {
assert.equal(result.length, 1, 'Unexpected number of results for @enabled query with quoted category');
assert.equal(result.get(0).name, localEnabledTheme.manifest.name, 'Unexpected extension for @enabled query with quoted category.');
});
const enabledCategoryWithSpaceCheck = testableView.show('@enabled category:"programming languages"').then(result => {
await testableView.show('@enabled category:"programming languages"').then(result => {
assert.equal(result.length, 1, 'Unexpected number of results for @enabled query with quoted category inlcuding space');
assert.equal(result.get(0).name, localEnabledLanguage.manifest.name, 'Unexpected extension for @enabled query with quoted category including space.');
});
const disabledCategoryWithoutQuotesCheck = testableView.show('@disabled category:themes').then(result => {
await testableView.show('@disabled category:themes').then(result => {
assert.equal(result.length, 1, 'Unexpected number of results for @disabled query with category');
assert.equal(result.get(0).name, localDisabledTheme.manifest.name, 'Unexpected extension for @disabled query with category.');
});
const disabledCategoryWithQuotesCheck = testableView.show('@disabled category:"themes"').then(result => {
await testableView.show('@disabled category:"themes"').then(result => {
assert.equal(result.length, 1, 'Unexpected number of results for @disabled query with quoted category');
assert.equal(result.get(0).name, localDisabledTheme.manifest.name, 'Unexpected extension for @disabled query with quoted category.');
});
const disabledCategoryWithSpaceCheck = testableView.show('@disabled category:"programming languages"').then(result => {
await testableView.show('@disabled category:"programming languages"').then(result => {
assert.equal(result.length, 1, 'Unexpected number of results for @disabled query with quoted category inlcuding space');
assert.equal(result.get(0).name, localDisabledLanguage.manifest.name, 'Unexpected extension for @disabled query with quoted category including space.');
});
return Promise.resolve([
installedCategoryWithoutQuotesCheck,
installedCategoryWithQuotesCheck,
installedCategoryWithSpaceCheck,
installedMultipleCategoryCheck,
enabledCategoryWithoutQuotesCheck,
enabledCategoryWithQuotesCheck,
enabledCategoryWithSpaceCheck,
disabledCategoryWithoutQuotesCheck,
disabledCategoryWithQuotesCheck,
disabledCategoryWithSpaceCheck
]);
});
test('Test @recommended:workspace query', () => {
@@ -523,5 +500,15 @@ suite('ExtensionsListView Tests', () => {
function aPage<T>(...objects: T[]): IPager<T> {
return { firstPage: objects, total: objects.length, pageSize: objects.length, getPage: () => null! };
}
function toExtensionDescription(local: ILocalExtension): IExtensionDescription {
return {
identifier: new ExtensionIdentifier(local.identifier.id),
isBuiltin: local.type === ExtensionType.System,
isUnderDevelopment: false,
extensionLocation: local.location,
...local.manifest
};
}
});

View File

@@ -70,10 +70,8 @@ suite('ExtensionsWorkbenchServiceTest', () => {
instantiationService.stub(IWorkspaceContextService, new TestContextService());
instantiationService.stub(IConfigurationService, {
onDidUpdateConfiguration: () => { },
onDidChangeConfiguration: () => { },
getConfiguration: () => ({}),
getValue: (key) => {
onDidChangeConfiguration: () => { return undefined!; },
getValue: (key?) => {
return (key === AutoCheckUpdatesConfigurationKey || key === AutoUpdateConfigurationKey) ? true : undefined;
}
});
@@ -91,7 +89,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
instantiationService.set(IExtensionTipsService, instantiationService.createInstance(ExtensionTipsService));
instantiationService.stub(INotificationService, { prompt: () => null });
instantiationService.stub(INotificationService, { prompt: () => null! });
});
setup(async () => {
@@ -133,7 +131,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
testObject = await aWorkbenchService();
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(expected));
return testObject.queryGallery().then(pagedResponse => {
return testObject.queryGallery(CancellationToken.None).then(pagedResponse => {
assert.equal(1, pagedResponse.firstPage.length);
const actual = pagedResponse.firstPage[0];
@@ -332,7 +330,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
testObject = await aWorkbenchService();
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
return testObject.queryGallery().then(page => {
return testObject.queryGallery(CancellationToken.None).then(page => {
const extension = page.firstPage[0];
assert.equal(ExtensionState.Uninstalled, extension.state);
@@ -416,7 +414,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
const target = sinon.spy();
return testObject.queryGallery().then(page => {
return testObject.queryGallery(CancellationToken.None).then(page => {
const extension = page.firstPage[0];
assert.equal(ExtensionState.Uninstalled, extension.state);
@@ -437,7 +435,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
const target = sinon.spy();
return testObject.queryGallery().then(page => {
return testObject.queryGallery(CancellationToken.None).then(page => {
const extension = page.firstPage[0];
assert.equal(ExtensionState.Uninstalled, extension.state);
@@ -482,7 +480,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
testObject = await aWorkbenchService();
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(aGalleryExtension('a')));
return testObject.queryGallery().then(page => {
return testObject.queryGallery(CancellationToken.None).then(page => {
return testObject.loadDependencies(page.firstPage[0], CancellationToken.None).then(dependencies => {
assert.equal(null, dependencies);
});
@@ -494,7 +492,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(aGalleryExtension('a', {}, { dependencies: ['pub.b', 'pub.c', 'pub.d'] })));
instantiationService.stubPromise(IExtensionGalleryService, 'loadAllDependencies', [aGalleryExtension('b'), aGalleryExtension('c'), aGalleryExtension('d')]);
return testObject.queryGallery().then(page => {
return testObject.queryGallery(CancellationToken.None).then(page => {
const extension = page.firstPage[0];
return testObject.loadDependencies(extension, CancellationToken.None).then(actual => {
assert.ok(actual!.hasDependencies);
@@ -533,7 +531,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(aGalleryExtension('a', {}, { dependencies: ['pub.b', 'pub.a'] })));
instantiationService.stubPromise(IExtensionGalleryService, 'loadAllDependencies', [aGalleryExtension('b'), aGalleryExtension('a')]);
return testObject.queryGallery().then(page => {
return testObject.queryGallery(CancellationToken.None).then(page => {
const extension = page.firstPage[0];
return testObject.loadDependencies(extension, CancellationToken.None).then(actual => {
assert.ok(actual!.hasDependencies);
@@ -565,7 +563,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(aGalleryExtension('a', {}, { dependencies: ['pub.b', 'pub.a'] })));
instantiationService.stubPromise(IExtensionGalleryService, 'loadAllDependencies', [aGalleryExtension('a')]);
return testObject.queryGallery().then(page => {
return testObject.queryGallery(CancellationToken.None).then(page => {
const extension = page.firstPage[0];
return testObject.loadDependencies(extension, CancellationToken.None).then(actual => {
assert.ok(actual!.hasDependencies);
@@ -599,7 +597,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(aGalleryExtension('a', {}, { dependencies: ['pub.inbuilt', 'pub.a'] })));
instantiationService.stubPromise(IExtensionGalleryService, 'loadAllDependencies', [aGalleryExtension('a')]);
return testObject.queryGallery().then(page => {
return testObject.queryGallery(CancellationToken.None).then(page => {
const extension = page.firstPage[0];
return testObject.loadDependencies(extension, CancellationToken.None).then(actual => {
assert.ok(actual!.hasDependencies);
@@ -637,7 +635,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
aGalleryExtension('d', {}, { dependencies: ['pub.f', 'pub.c'] }),
aGalleryExtension('e')]);
return testObject.queryGallery().then(page => {
return testObject.queryGallery(CancellationToken.None).then(page => {
const extension = page.firstPage[0];
return testObject.loadDependencies(extension, CancellationToken.None).then(a => {
assert.ok(a!.hasDependencies);
@@ -726,7 +724,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
.then(async () => {
testObject = await aWorkbenchService();
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(aGalleryExtension('a')));
return testObject.queryGallery().then(pagedResponse => {
return testObject.queryGallery(CancellationToken.None).then(pagedResponse => {
const actual = pagedResponse.firstPage[0];
assert.equal(actual.enablementState, EnablementState.Enabled);
});