mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8 (#14883)
* Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8 * Bump distro * Upgrade GCC to 4.9 due to yarn install errors * Update build image * Fix bootstrap base url * Bump distro * Fix build errors * Update source map file * Disable checkbox for blocking migration issues (#15131) * disable checkbox for blocking issues * wip * disable checkbox fixes * fix strings * Remove duplicate tsec command * Default to off for tab color if settings not present * re-skip failing tests * Fix mocha error * Bump sqlite version & fix notebooks search view * Turn off esbuild warnings * Update esbuild log level * Fix overflowactionbar tests * Fix ts-ignore in dropdown tests * cleanup/fixes * Fix hygiene * Bundle in entire zone.js module * Remove extra constructor param * bump distro for web compile break * bump distro for web compile break v2 * Undo log level change * New distro * Fix integration test scripts * remove the "no yarn.lock changes" workflow * fix scripts v2 * Update unit test scripts * Ensure ads-kerberos2 updates in .vscodeignore * Try fix unit tests * Upload crash reports * remove nogpu * always upload crashes * Use bash script * Consolidate data/ext dir names * Create in tmp directory Co-authored-by: chlafreniere <hichise@gmail.com> Co-authored-by: Christopher Suh <chsuh@microsoft.com> Co-authored-by: chgagnon <chgagnon@microsoft.com>
This commit is contained in:
@@ -152,6 +152,12 @@ const DefaultQueryState: IQueryState = {
|
||||
assetTypes: []
|
||||
};
|
||||
|
||||
type QueryTelemetryData = {
|
||||
filterTypes: string[];
|
||||
sortBy: string;
|
||||
sortOrder: string;
|
||||
};
|
||||
|
||||
class Query {
|
||||
|
||||
constructor(private state = DefaultQueryState) { }
|
||||
@@ -203,6 +209,14 @@ class Query {
|
||||
const criterium = this.state.criteria.filter(criterium => criterium.filterType === FilterType.SearchText)[0];
|
||||
return criterium && criterium.value ? criterium.value : '';
|
||||
}
|
||||
|
||||
get telemetryData(): QueryTelemetryData {
|
||||
return {
|
||||
filterTypes: this.state.criteria.map(criterium => String(criterium.filterType)),
|
||||
sortBy: String(this.sortBy),
|
||||
sortOrder: String(this.sortOrder)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function getStatistic(statistics: IRawGalleryExtensionStatistics[], name: string): number {
|
||||
|
||||
@@ -282,3 +282,19 @@ export const ExtensionsLocalizedLabel = { value: ExtensionsLabel, original: 'Ext
|
||||
export const ExtensionsChannelId = 'extensions';
|
||||
export const PreferencesLabel = localize('preferences', "Preferences");
|
||||
export const PreferencesLocalizedLabel = { value: PreferencesLabel, original: 'Preferences' };
|
||||
|
||||
|
||||
export interface CLIOutput {
|
||||
log(s: string): void;
|
||||
error(s: string): void;
|
||||
}
|
||||
|
||||
export const IExtensionManagementCLIService = createDecorator<IExtensionManagementCLIService>('IExtensionManagementCLIService');
|
||||
export interface IExtensionManagementCLIService {
|
||||
readonly _serviceBrand: undefined;
|
||||
|
||||
listExtensions(showVersions: boolean, category?: string, output?: CLIOutput): Promise<void>;
|
||||
installExtensions(extensions: (string | URI)[], builtinExtensionIds: string[], isMachineScoped: boolean, force: boolean, output?: CLIOutput): Promise<void>;
|
||||
uninstallExtensions(extensions: (string | URI)[], force: boolean, output?: CLIOutput): Promise<void>;
|
||||
locateExtension(extensions: string[], output?: CLIOutput): Promise<void>;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,347 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
|
||||
import { isPromiseCanceledError } from 'vs/base/common/errors';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { gt } from 'vs/base/common/semver/semver';
|
||||
import { CLIOutput, IExtensionGalleryService, IExtensionManagementCLIService, IExtensionManagementService, IGalleryExtension, ILocalExtension, InstallOptions } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { adoptToGalleryExtensionId, areSameExtensions, getGalleryExtensionId } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { ExtensionType, EXTENSION_CATEGORIES, IExtensionManifest, isLanguagePackExtension } from 'vs/platform/extensions/common/extensions';
|
||||
import { getBaseLabel } from 'vs/base/common/labels';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { ILocalizationsService } from 'vs/platform/localizations/common/localizations';
|
||||
|
||||
const notFound = (id: string) => localize('notFound', "Extension '{0}' not found.", id);
|
||||
const useId = localize('useId', "Make sure you use the full extension ID, including the publisher, e.g.: {0}", 'ms-dotnettools.csharp');
|
||||
|
||||
|
||||
function getId(manifest: IExtensionManifest, withVersion?: boolean): string {
|
||||
if (withVersion) {
|
||||
return `${manifest.publisher}.${manifest.name}@${manifest.version}`;
|
||||
} else {
|
||||
return `${manifest.publisher}.${manifest.name}`;
|
||||
}
|
||||
}
|
||||
|
||||
const EXTENSION_ID_REGEX = /^([^.]+\..+)@(\d+\.\d+\.\d+(-.*)?)$/;
|
||||
|
||||
export function getIdAndVersion(id: string): [string, string | undefined] {
|
||||
const matches = EXTENSION_ID_REGEX.exec(id);
|
||||
if (matches && matches[1]) {
|
||||
return [adoptToGalleryExtensionId(matches[1]), matches[2]];
|
||||
}
|
||||
return [adoptToGalleryExtensionId(id), undefined];
|
||||
}
|
||||
|
||||
type InstallExtensionInfo = { id: string, version?: string, installOptions: InstallOptions };
|
||||
|
||||
|
||||
export class ExtensionManagementCLIService implements IExtensionManagementCLIService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
constructor(
|
||||
@IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService,
|
||||
@IExtensionGalleryService private readonly extensionGalleryService: IExtensionGalleryService,
|
||||
@ILocalizationsService private readonly localizationsService: ILocalizationsService
|
||||
) { }
|
||||
|
||||
protected get location(): string | undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public async listExtensions(showVersions: boolean, category?: string, output: CLIOutput = console): Promise<void> {
|
||||
let extensions = await this.extensionManagementService.getInstalled(ExtensionType.User);
|
||||
const categories = EXTENSION_CATEGORIES.map(c => c.toLowerCase());
|
||||
if (category && category !== '') {
|
||||
if (categories.indexOf(category.toLowerCase()) < 0) {
|
||||
output.log('Invalid category please enter a valid category. To list valid categories run --category without a category specified');
|
||||
return;
|
||||
}
|
||||
extensions = extensions.filter(e => {
|
||||
if (e.manifest.categories) {
|
||||
const lowerCaseCategories: string[] = e.manifest.categories.map(c => c.toLowerCase());
|
||||
return lowerCaseCategories.indexOf(category.toLowerCase()) > -1;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
} else if (category === '') {
|
||||
output.log('Possible Categories: ');
|
||||
categories.forEach(category => {
|
||||
output.log(category);
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (this.location) {
|
||||
output.log(localize('listFromLocation', "Extensions installed on {0}:", this.location));
|
||||
}
|
||||
|
||||
extensions = extensions.sort((e1, e2) => e1.identifier.id.localeCompare(e2.identifier.id));
|
||||
let lastId: string | undefined = undefined;
|
||||
for (let extension of extensions) {
|
||||
if (lastId !== extension.identifier.id) {
|
||||
lastId = extension.identifier.id;
|
||||
output.log(getId(extension.manifest, showVersions));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async installExtensions(extensions: (string | URI)[], builtinExtensionIds: string[], isMachineScoped: boolean, force: boolean, output: CLIOutput = console): Promise<void> {
|
||||
const failed: string[] = [];
|
||||
const installedExtensionsManifests: IExtensionManifest[] = [];
|
||||
if (extensions.length) {
|
||||
output.log(this.location ? localize('installingExtensionsOnLocation', "Installing extensions on {0}...", this.location) : localize('installingExtensions', "Installing extensions..."));
|
||||
}
|
||||
|
||||
const installed = await this.extensionManagementService.getInstalled(ExtensionType.User);
|
||||
const checkIfNotInstalled = (id: string, version?: string): boolean => {
|
||||
const installedExtension = installed.find(i => areSameExtensions(i.identifier, { id }));
|
||||
if (installedExtension) {
|
||||
if (!version && !force) {
|
||||
output.log(localize('alreadyInstalled-checkAndUpdate', "Extension '{0}' v{1} is already installed. Use '--force' option to update to latest version or provide '@<version>' to install a specific version, for example: '{2}@1.2.3'.", id, installedExtension.manifest.version, id));
|
||||
return false;
|
||||
}
|
||||
if (version && installedExtension.manifest.version === version) {
|
||||
output.log(localize('alreadyInstalled', "Extension '{0}' is already installed.", `${id}@${version}`));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
const vsixs: URI[] = [];
|
||||
const installExtensionInfos: InstallExtensionInfo[] = [];
|
||||
for (const extension of extensions) {
|
||||
if (extension instanceof URI) {
|
||||
vsixs.push(extension);
|
||||
} else {
|
||||
const [id, version] = getIdAndVersion(extension);
|
||||
if (checkIfNotInstalled(id, version)) {
|
||||
installExtensionInfos.push({ id, version, installOptions: { isBuiltin: false, isMachineScoped } });
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const extension of builtinExtensionIds) {
|
||||
const [id, version] = getIdAndVersion(extension);
|
||||
if (checkIfNotInstalled(id, version)) {
|
||||
installExtensionInfos.push({ id, version, installOptions: { isBuiltin: true, isMachineScoped: false } });
|
||||
}
|
||||
}
|
||||
|
||||
if (vsixs.length) {
|
||||
await Promise.all(vsixs.map(async vsix => {
|
||||
try {
|
||||
const manifest = await this.installVSIX(vsix, force, output);
|
||||
if (manifest) {
|
||||
installedExtensionsManifests.push(manifest);
|
||||
}
|
||||
} catch (err) {
|
||||
output.error(err.message || err.stack || err);
|
||||
failed.push(vsix.toString());
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
if (installExtensionInfos.length) {
|
||||
|
||||
const galleryExtensions = await this.getGalleryExtensions(installExtensionInfos);
|
||||
|
||||
await Promise.all(installExtensionInfos.map(async extensionInfo => {
|
||||
const gallery = galleryExtensions.get(extensionInfo.id.toLowerCase());
|
||||
if (gallery) {
|
||||
try {
|
||||
const manifest = await this.installFromGallery(extensionInfo, gallery, installed, force, output);
|
||||
if (manifest) {
|
||||
installedExtensionsManifests.push(manifest);
|
||||
}
|
||||
} catch (err) {
|
||||
output.error(err.message || err.stack || err);
|
||||
failed.push(extensionInfo.id);
|
||||
}
|
||||
} else {
|
||||
output.error(`${notFound(extensionInfo.version ? `${extensionInfo.id}@${extensionInfo.version}` : extensionInfo.id)}\n${useId}`);
|
||||
failed.push(extensionInfo.id);
|
||||
}
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
if (installedExtensionsManifests.some(manifest => isLanguagePackExtension(manifest))) {
|
||||
await this.updateLocalizationsCache();
|
||||
}
|
||||
|
||||
if (failed.length) {
|
||||
throw new Error(localize('installation failed', "Failed Installing Extensions: {0}", failed.join(', ')));
|
||||
}
|
||||
}
|
||||
|
||||
private async installVSIX(vsix: URI, force: boolean, output: CLIOutput): Promise<IExtensionManifest | null> {
|
||||
|
||||
const manifest = await this.extensionManagementService.getManifest(vsix);
|
||||
if (!manifest) {
|
||||
throw new Error('Invalid vsix');
|
||||
}
|
||||
|
||||
const valid = await this.validateVSIX(manifest, force, output);
|
||||
if (valid) {
|
||||
try {
|
||||
await this.extensionManagementService.install(vsix);
|
||||
output.log(localize('successVsixInstall', "Extension '{0}' was successfully installed.", getBaseLabel(vsix)));
|
||||
return manifest;
|
||||
} catch (error) {
|
||||
if (isPromiseCanceledError(error)) {
|
||||
output.log(localize('cancelVsixInstall', "Cancelled installing extension '{0}'.", getBaseLabel(vsix)));
|
||||
return null;
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private async getGalleryExtensions(extensions: InstallExtensionInfo[]): Promise<Map<string, IGalleryExtension>> {
|
||||
const extensionIds = extensions.filter(({ version }) => version === undefined).map(({ id }) => id);
|
||||
const extensionsWithIdAndVersion = extensions.filter(({ version }) => version !== undefined);
|
||||
|
||||
const galleryExtensions = new Map<string, IGalleryExtension>();
|
||||
await Promise.all([
|
||||
(async () => {
|
||||
const result = await this.extensionGalleryService.getExtensions(extensionIds, CancellationToken.None);
|
||||
result.forEach(extension => galleryExtensions.set(extension.identifier.id.toLowerCase(), extension));
|
||||
})(),
|
||||
Promise.all(extensionsWithIdAndVersion.map(async ({ id, version }) => {
|
||||
const extension = await this.extensionGalleryService.getCompatibleExtension({ id }, version);
|
||||
if (extension) {
|
||||
galleryExtensions.set(extension.identifier.id.toLowerCase(), extension);
|
||||
}
|
||||
}))
|
||||
]);
|
||||
|
||||
return galleryExtensions;
|
||||
}
|
||||
|
||||
private async installFromGallery({ id, version, installOptions }: InstallExtensionInfo, galleryExtension: IGalleryExtension, installed: ILocalExtension[], force: boolean, output: CLIOutput): Promise<IExtensionManifest | null> {
|
||||
const manifest = await this.extensionGalleryService.getManifest(galleryExtension, CancellationToken.None);
|
||||
if (manifest && !this.validateExtensionKind(manifest, output)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const installedExtension = installed.find(e => areSameExtensions(e.identifier, galleryExtension.identifier));
|
||||
if (installedExtension) {
|
||||
if (galleryExtension.version === installedExtension.manifest.version) {
|
||||
output.log(localize('alreadyInstalled', "Extension '{0}' is already installed.", version ? `${id}@${version}` : id));
|
||||
return null;
|
||||
}
|
||||
output.log(localize('updateMessage', "Updating the extension '{0}' to the version {1}", id, galleryExtension.version));
|
||||
}
|
||||
|
||||
try {
|
||||
if (installOptions.isBuiltin) {
|
||||
output.log(localize('installing builtin ', "Installing builtin extension '{0}' v{1}...", id, galleryExtension.version));
|
||||
} else {
|
||||
output.log(localize('installing', "Installing extension '{0}' v{1}...", id, galleryExtension.version));
|
||||
}
|
||||
|
||||
await this.extensionManagementService.installFromGallery(galleryExtension, installOptions);
|
||||
output.log(localize('successInstall', "Extension '{0}' v{1} was successfully installed.", id, galleryExtension.version));
|
||||
return manifest;
|
||||
} catch (error) {
|
||||
if (isPromiseCanceledError(error)) {
|
||||
output.log(localize('cancelInstall', "Cancelled installing extension '{0}'.", id));
|
||||
return null;
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected validateExtensionKind(_manifest: IExtensionManifest, output: CLIOutput): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
private async validateVSIX(manifest: IExtensionManifest, force: boolean, output: CLIOutput): Promise<boolean> {
|
||||
const extensionIdentifier = { id: getGalleryExtensionId(manifest.publisher, manifest.name) };
|
||||
const installedExtensions = await this.extensionManagementService.getInstalled(ExtensionType.User);
|
||||
const newer = installedExtensions.find(local => areSameExtensions(extensionIdentifier, local.identifier) && gt(local.manifest.version, manifest.version));
|
||||
|
||||
if (newer && !force) {
|
||||
output.log(localize('forceDowngrade', "A newer version of extension '{0}' v{1} is already installed. Use '--force' option to downgrade to older version.", newer.identifier.id, newer.manifest.version, manifest.version));
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.validateExtensionKind(manifest, output);
|
||||
}
|
||||
|
||||
public async uninstallExtensions(extensions: (string | URI)[], force: boolean, output: CLIOutput = console): Promise<void> {
|
||||
const getExtensionId = async (extensionDescription: string | URI): Promise<string> => {
|
||||
if (extensionDescription instanceof URI) {
|
||||
const manifest = await this.extensionManagementService.getManifest(extensionDescription);
|
||||
return getId(manifest);
|
||||
}
|
||||
return extensionDescription;
|
||||
};
|
||||
|
||||
const uninstalledExtensions: ILocalExtension[] = [];
|
||||
for (const extension of extensions) {
|
||||
const id = await getExtensionId(extension);
|
||||
const installed = await this.extensionManagementService.getInstalled();
|
||||
const extensionsToUninstall = installed.filter(e => areSameExtensions(e.identifier, { id }));
|
||||
if (!extensionsToUninstall.length) {
|
||||
throw new Error(`${this.notInstalled(id)}\n${useId}`);
|
||||
}
|
||||
if (extensionsToUninstall.some(e => e.type === ExtensionType.System)) {
|
||||
output.log(localize('builtin', "Extension '{0}' is a Built-in extension and cannot be uninstalled", id));
|
||||
return;
|
||||
}
|
||||
if (!force && extensionsToUninstall.some(e => e.isBuiltin)) {
|
||||
output.log(localize('forceUninstall', "Extension '{0}' is marked as a Built-in extension by user. Please use '--force' option to uninstall it.", id));
|
||||
return;
|
||||
}
|
||||
output.log(localize('uninstalling', "Uninstalling {0}...", id));
|
||||
for (const extensionToUninstall of extensionsToUninstall) {
|
||||
await this.extensionManagementService.uninstall(extensionToUninstall);
|
||||
uninstalledExtensions.push(extensionToUninstall);
|
||||
}
|
||||
|
||||
if (this.location) {
|
||||
output.log(localize('successUninstallFromLocation', "Extension '{0}' was successfully uninstalled from {1}!", id, this.location));
|
||||
} else {
|
||||
output.log(localize('successUninstall', "Extension '{0}' was successfully uninstalled!", id));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (uninstalledExtensions.some(e => isLanguagePackExtension(e.manifest))) {
|
||||
await this.updateLocalizationsCache();
|
||||
}
|
||||
}
|
||||
|
||||
public async locateExtension(extensions: string[], output: CLIOutput = console): Promise<void> {
|
||||
const installed = await this.extensionManagementService.getInstalled();
|
||||
extensions.forEach(e => {
|
||||
installed.forEach(i => {
|
||||
if (i.identifier.id === e) {
|
||||
if (i.location.scheme === Schemas.file) {
|
||||
output.log(i.location.fsPath);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private updateLocalizationsCache(): Promise<boolean> {
|
||||
return this.localizationsService.update();
|
||||
}
|
||||
|
||||
private notInstalled(id: string) {
|
||||
return this.location ? localize('notInstalleddOnLocation', "Extension '{0}' is not installed on {1}.", id, this.location) : localize('notInstalled', "Extension '{0}' is not installed.", id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,12 +42,16 @@ export class ExtensionIdentifierWithVersion implements IExtensionIdentifierWithV
|
||||
}
|
||||
}
|
||||
|
||||
export function getExtensionId(publisher: string, name: string): string {
|
||||
return `${publisher}.${name}`;
|
||||
}
|
||||
|
||||
export function adoptToGalleryExtensionId(id: string): string {
|
||||
return id.toLocaleLowerCase();
|
||||
}
|
||||
|
||||
export function getGalleryExtensionId(publisher: string, name: string): string {
|
||||
return `${publisher.toLocaleLowerCase()}.${name.toLocaleLowerCase()}`;
|
||||
return adoptToGalleryExtensionId(getExtensionId(publisher, name));
|
||||
}
|
||||
|
||||
export function groupByExtension<T>(extensions: T[], getExtensionIdentifier: (t: T) => IExtensionIdentifier): T[][] {
|
||||
|
||||
@@ -21,6 +21,8 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IExtensionRecommendationNotificationService, RecommendationsNotificationResult, RecommendationSource } from 'vs/platform/extensionRecommendations/common/extensionRecommendations';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { INativeHostService } from 'vs/platform/native/electron-sandbox/native';
|
||||
|
||||
type ExeExtensionRecommendationsClassification = {
|
||||
extensionId: { classification: 'PublicNonPersonalData', purpose: 'FeatureInsight' };
|
||||
@@ -52,6 +54,7 @@ export class ExtensionTipsService extends BaseExtensionTipsService {
|
||||
@ITelemetryService private readonly telemetryService: ITelemetryService,
|
||||
@IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService,
|
||||
@IStorageService private readonly storageService: IStorageService,
|
||||
@INativeHostService private readonly nativeHostService: INativeHostService,
|
||||
@IExtensionRecommendationNotificationService private readonly extensionRecommendationNotificationService: IExtensionRecommendationNotificationService,
|
||||
@IFileService fileService: IFileService,
|
||||
@IProductService productService: IProductService,
|
||||
@@ -172,6 +175,11 @@ export class ExtensionTipsService extends BaseExtensionTipsService {
|
||||
case RecommendationsNotificationResult.Ignored:
|
||||
this.highImportanceTipsByExe.delete(exeName);
|
||||
break;
|
||||
case RecommendationsNotificationResult.IncompatibleWindow:
|
||||
// Recommended in incompatible window. Schedule the prompt after active window change
|
||||
const onActiveWindowChange = Event.once(Event.latch(Event.any(this.nativeHostService.onDidOpenWindow, this.nativeHostService.onDidFocusWindow)));
|
||||
this._register(onActiveWindowChange(() => this.promptHighImportanceExeBasedTip()));
|
||||
break;
|
||||
case RecommendationsNotificationResult.TooMany:
|
||||
// Too many notifications. Schedule the prompt after one hour
|
||||
const disposable = this._register(disposableTimeout(() => { disposable.dispose(); this.promptHighImportanceExeBasedTip(); }, 60 * 60 * 1000 /* 1 hour */));
|
||||
@@ -217,6 +225,12 @@ export class ExtensionTipsService extends BaseExtensionTipsService {
|
||||
this.promptMediumImportanceExeBasedTip();
|
||||
break;
|
||||
|
||||
case RecommendationsNotificationResult.IncompatibleWindow:
|
||||
// Recommended in incompatible window. Schedule the prompt after active window change
|
||||
const onActiveWindowChange = Event.once(Event.latch(Event.any(this.nativeHostService.onDidOpenWindow, this.nativeHostService.onDidFocusWindow)));
|
||||
this._register(onActiveWindowChange(() => this.promptMediumImportanceExeBasedTip()));
|
||||
break;
|
||||
|
||||
case RecommendationsNotificationResult.TooMany:
|
||||
// Too many notifications. Schedule the prompt after one hour
|
||||
const disposable2 = this._register(disposableTimeout(() => { disposable2.dispose(); this.promptMediumImportanceExeBasedTip(); }, 60 * 60 * 1000 /* 1 hour */));
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { promises } from 'fs';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { rename } from 'vs/base/node/pfs';
|
||||
import { IFileService, IFileStatWithMetadata } from 'vs/platform/files/common/files';
|
||||
import { IExtensionGalleryService, IGalleryExtension, InstallOperation } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { INativeEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
@@ -15,6 +15,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import * as semver from 'vs/base/common/semver/semver';
|
||||
import { isWindows } from 'vs/base/common/platform';
|
||||
import { Promises } from 'vs/base/common/async';
|
||||
|
||||
const ExtensionIdVersionRegex = /^([^.]+\..+)-(\d+\.\d+\.\d+)$/;
|
||||
|
||||
@@ -62,7 +63,7 @@ export class ExtensionsDownloader extends Disposable {
|
||||
|
||||
private async rename(from: URI, to: URI, retryUntil: number): Promise<void> {
|
||||
try {
|
||||
await rename(from.fsPath, to.fsPath);
|
||||
await promises.rename(from.fsPath, to.fsPath);
|
||||
} catch (error) {
|
||||
if (isWindows && error && error.code === 'EPERM' && Date.now() < retryUntil) {
|
||||
this.logService.info(`Failed renaming ${from} to ${to} with 'EPERM' error. Trying again...`);
|
||||
@@ -97,7 +98,7 @@ export class ExtensionsDownloader extends Disposable {
|
||||
}
|
||||
distinct.sort((a, b) => a.mtime - b.mtime); // sort by modified time
|
||||
toDelete.push(...distinct.slice(0, Math.max(0, distinct.length - this.cache)).map(s => s.resource)); // Retain minimum cacheSize and delete the rest
|
||||
await Promise.all(toDelete.map(resource => {
|
||||
await Promises.settled(toDelete.map(resource => {
|
||||
this.logService.trace('Deleting vsix from cache', resource.path);
|
||||
return this.fileService.del(resource);
|
||||
}));
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as nls from 'vs/nls';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import * as pfs from 'vs/base/node/pfs';
|
||||
@@ -24,7 +25,7 @@ import {
|
||||
} from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { areSameExtensions, getGalleryExtensionId, getMaliciousExtensionsSet, getGalleryExtensionTelemetryData, getLocalExtensionTelemetryData, ExtensionIdentifierWithVersion } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { INativeEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { createCancelablePromise, CancelablePromise } from 'vs/base/common/async';
|
||||
import { createCancelablePromise, CancelablePromise, Promises } from 'vs/base/common/async';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import * as semver from 'vs/base/common/semver/semver';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
@@ -129,7 +130,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
|
||||
const collectFilesFromDirectory = async (dir: string): Promise<string[]> => {
|
||||
let entries = await pfs.readdir(dir);
|
||||
entries = entries.map(e => path.join(dir, e));
|
||||
const stats = await Promise.all(entries.map(e => pfs.stat(e)));
|
||||
const stats = await Promise.all(entries.map(e => fs.promises.stat(e)));
|
||||
let promise: Promise<string[]> = Promise.resolve([]);
|
||||
stats.forEach((stat, index) => {
|
||||
const entry = entries[index];
|
||||
@@ -477,7 +478,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
|
||||
const galleryResult = await this.galleryService.query({ names, pageSize: dependenciesAndPackExtensions.length }, CancellationToken.None);
|
||||
const extensionsToInstall = galleryResult.firstPage;
|
||||
try {
|
||||
await Promise.all(extensionsToInstall.map(e => this.installFromGallery(e, options)));
|
||||
await Promises.settled(extensionsToInstall.map(e => this.installFromGallery(e, options)));
|
||||
} catch (error) {
|
||||
try { await this.rollback(extensionsToInstall); } catch (e) { /* ignore */ }
|
||||
throw error;
|
||||
@@ -489,7 +490,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
|
||||
private async rollback(extensions: IGalleryExtension[]): Promise<void> {
|
||||
const installed = await this.getInstalled(ExtensionType.User);
|
||||
const extensionsToUninstall = installed.filter(local => extensions.some(galleryExtension => new ExtensionIdentifierWithVersion(local.identifier, local.manifest.version).equals(new ExtensionIdentifierWithVersion(galleryExtension.identifier, galleryExtension.version)))); // Check with version because we want to rollback the exact version
|
||||
await Promise.all(extensionsToUninstall.map(local => this.uninstall(local)));
|
||||
await Promises.settled(extensionsToUninstall.map(local => this.uninstall(local)));
|
||||
}
|
||||
|
||||
async uninstall(extension: ILocalExtension, options: UninstallOptions = {}): Promise<void> {
|
||||
@@ -574,7 +575,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
|
||||
this.checkForDependents(e, extensionsToUninstall, installed, extension);
|
||||
}
|
||||
}
|
||||
await Promise.all([this.uninstallExtension(extension), ...otherExtensionsToUninstall.map(d => this.doUninstall(d))]);
|
||||
await Promises.settled([this.uninstallExtension(extension), ...otherExtensionsToUninstall.map(d => this.doUninstall(d))]);
|
||||
}
|
||||
|
||||
private checkForDependents(extension: ILocalExtension, extensionsToUninstall: ILocalExtension[], installed: ILocalExtension[], extensionToUninstall: ILocalExtension): void {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as semver from 'vs/base/common/semver/semver';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import * as pfs from 'vs/base/node/pfs';
|
||||
@@ -11,7 +12,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { ILocalExtension, IGalleryMetadata, ExtensionManagementError } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { ExtensionType, IExtensionManifest, IExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { areSameExtensions, ExtensionIdentifierWithVersion, groupByExtension, getGalleryExtensionId } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { Limiter, Queue } from 'vs/base/common/async';
|
||||
import { Limiter, Promises, Queue } from 'vs/base/common/async';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { INativeEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { localizeManifest } from 'vs/platform/extensionManagement/common/extensionNls';
|
||||
@@ -138,7 +139,7 @@ export class ExtensionsScanner extends Disposable {
|
||||
metadata.isMachineScoped = metadata.isMachineScoped || undefined;
|
||||
metadata.isBuiltin = metadata.isBuiltin || undefined;
|
||||
const manifestPath = path.join(local.location.fsPath, 'package.json');
|
||||
const raw = await pfs.readFile(manifestPath, 'utf8');
|
||||
const raw = await fs.promises.readFile(manifestPath, 'utf8');
|
||||
const { manifest } = await this.parseManifest(raw);
|
||||
(manifest as ILocalExtensionManifest).__metadata = metadata;
|
||||
await pfs.writeFile(manifestPath, JSON.stringify(manifest, null, '\t'));
|
||||
@@ -153,7 +154,7 @@ export class ExtensionsScanner extends Disposable {
|
||||
return this.uninstalledFileLimiter.queue(async () => {
|
||||
let raw: string | undefined;
|
||||
try {
|
||||
raw = await pfs.readFile(this.uninstalledPath, 'utf8');
|
||||
raw = await fs.promises.readFile(this.uninstalledPath, 'utf8');
|
||||
} catch (err) {
|
||||
if (err.code !== 'ENOENT') {
|
||||
throw err;
|
||||
@@ -211,7 +212,7 @@ export class ExtensionsScanner extends Disposable {
|
||||
|
||||
private async rename(identifier: IExtensionIdentifier, extractPath: string, renamePath: string, retryUntil: number): Promise<void> {
|
||||
try {
|
||||
await pfs.rename(extractPath, renamePath);
|
||||
await fs.promises.rename(extractPath, renamePath);
|
||||
} catch (error) {
|
||||
if (isWindows && error && error.code === 'EPERM' && Date.now() < retryUntil) {
|
||||
this.logService.info(`Failed renaming ${extractPath} to ${renamePath} with 'EPERM' error. Trying again...`, identifier.id);
|
||||
@@ -300,14 +301,14 @@ export class ExtensionsScanner extends Disposable {
|
||||
}
|
||||
}
|
||||
const byExtension: ILocalExtension[][] = groupByExtension(extensions, e => e.identifier);
|
||||
await Promise.all(byExtension.map(async e => {
|
||||
await Promises.settled(byExtension.map(async e => {
|
||||
const latest = e.sort((a, b) => semver.rcompare(a.manifest.version, b.manifest.version))[0];
|
||||
if (!installed.has(latest.identifier.id.toLowerCase())) {
|
||||
await this.beforeRemovingExtension(latest);
|
||||
}
|
||||
}));
|
||||
const toRemove: ILocalExtension[] = extensions.filter(e => uninstalled[new ExtensionIdentifierWithVersion(e.identifier, e.manifest.version).key()]);
|
||||
await Promise.all(toRemove.map(e => this.removeUninstalledExtension(e)));
|
||||
await Promises.settled(toRemove.map(e => this.removeUninstalledExtension(e)));
|
||||
}
|
||||
|
||||
private async removeOutdatedExtensions(): Promise<void> {
|
||||
@@ -318,7 +319,7 @@ export class ExtensionsScanner extends Disposable {
|
||||
const byExtension: ILocalExtension[][] = groupByExtension(extensions, e => e.identifier);
|
||||
toRemove.push(...flatten(byExtension.map(p => p.sort((a, b) => semver.rcompare(a.manifest.version, b.manifest.version)).slice(1))));
|
||||
|
||||
await Promise.all(toRemove.map(extension => this.removeExtension(extension, 'outdated')));
|
||||
await Promises.settled(toRemove.map(extension => this.removeExtension(extension, 'outdated')));
|
||||
}
|
||||
|
||||
private getDevSystemExtensionsList(): string[] {
|
||||
@@ -345,9 +346,9 @@ export class ExtensionsScanner extends Disposable {
|
||||
|
||||
private async readManifest(extensionPath: string): Promise<{ manifest: IExtensionManifest; metadata: IMetadata | null; }> {
|
||||
const promises = [
|
||||
pfs.readFile(path.join(extensionPath, 'package.json'), 'utf8')
|
||||
fs.promises.readFile(path.join(extensionPath, 'package.json'), 'utf8')
|
||||
.then(raw => this.parseManifest(raw)),
|
||||
pfs.readFile(path.join(extensionPath, 'package.nls.json'), 'utf8')
|
||||
fs.promises.readFile(path.join(extensionPath, 'package.nls.json'), 'utf8')
|
||||
.then(undefined, err => err.code !== 'ENOENT' ? Promise.reject<string>(err) : '{}')
|
||||
.then(raw => JSON.parse(raw))
|
||||
];
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { resolveMarketplaceHeaders } from 'vs/platform/extensionManagement/common/extensionGalleryService';
|
||||
import { isUUID } from 'vs/base/common/uuid';
|
||||
import { DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { FileService } from 'vs/platform/files/common/fileService';
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { InMemoryStorageService, IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { InMemoryFileSystemProvider } from 'vs/platform/files/common/inMemoryFilesystemProvider';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { joinPath } from 'vs/base/common/resources';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { mock } from 'vs/base/test/common/mock';
|
||||
|
||||
class EnvironmentServiceMock extends mock<IEnvironmentService>() {
|
||||
constructor(readonly serviceMachineIdResource: URI) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
suite('Extension Gallery Service', () => {
|
||||
const disposables: DisposableStore = new DisposableStore();
|
||||
let fileService: IFileService, environmentService: IEnvironmentService, storageService: IStorageService;
|
||||
|
||||
setup(() => {
|
||||
const serviceMachineIdResource = joinPath(URI.file('tests').with({ scheme: 'vscode-tests' }), 'machineid');
|
||||
environmentService = new EnvironmentServiceMock(serviceMachineIdResource);
|
||||
fileService = disposables.add(new FileService(new NullLogService()));
|
||||
const fileSystemProvider = disposables.add(new InMemoryFileSystemProvider());
|
||||
fileService.registerProvider(serviceMachineIdResource.scheme, fileSystemProvider);
|
||||
storageService = new InMemoryStorageService();
|
||||
});
|
||||
|
||||
teardown(() => disposables.clear());
|
||||
|
||||
test('marketplace machine id', async () => {
|
||||
const headers = await resolveMarketplaceHeaders(product.version, environmentService, fileService, storageService);
|
||||
assert.ok(isUUID(headers['X-Market-User-Id']));
|
||||
const headers2 = await resolveMarketplaceHeaders(product.version, environmentService, fileService, storageService);
|
||||
assert.equal(headers['X-Market-User-Id'], headers2['X-Market-User-Id']);
|
||||
});
|
||||
});
|
||||
@@ -1,178 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import * as os from 'os';
|
||||
import { NativeEnvironmentService } from 'vs/platform/environment/node/environmentService';
|
||||
import { parseArgs, OPTIONS } from 'vs/platform/environment/node/argv';
|
||||
import { getRandomTestPath } from 'vs/base/test/node/testUtils';
|
||||
import { join } from 'vs/base/common/path';
|
||||
import { mkdirp, RimRafMode, rimraf } from 'vs/base/node/pfs';
|
||||
import { resolveMarketplaceHeaders, ExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionGalleryService'; // {{SQL CARBON EDIT}} add imports
|
||||
import { isUUID } from 'vs/base/common/uuid';
|
||||
import { DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { FileService } from 'vs/platform/files/common/fileService';
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
import { DiskFileSystemProvider } from 'vs/platform/files/node/diskFileSystemProvider';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { TestStorageService } from 'vs/workbench/test/common/workbenchTestServices';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
|
||||
suite('Extension Gallery Service', () => {
|
||||
const parentDir = getRandomTestPath(os.tmpdir(), 'vsctests', 'extensiongalleryservice');
|
||||
const marketplaceHome = join(parentDir, 'Marketplace');
|
||||
let fileService: IFileService;
|
||||
let disposables: DisposableStore;
|
||||
|
||||
setup(done => {
|
||||
|
||||
disposables = new DisposableStore();
|
||||
fileService = new FileService(new NullLogService());
|
||||
disposables.add(fileService);
|
||||
|
||||
const diskFileSystemProvider = new DiskFileSystemProvider(new NullLogService());
|
||||
disposables.add(diskFileSystemProvider);
|
||||
fileService.registerProvider(Schemas.file, diskFileSystemProvider);
|
||||
|
||||
// Delete any existing backups completely and then re-create it.
|
||||
rimraf(marketplaceHome, RimRafMode.MOVE).then(() => {
|
||||
mkdirp(marketplaceHome).then(() => {
|
||||
done();
|
||||
}, error => done(error));
|
||||
}, error => done(error));
|
||||
});
|
||||
|
||||
teardown(done => {
|
||||
disposables.clear();
|
||||
rimraf(marketplaceHome, RimRafMode.MOVE).then(done, done);
|
||||
});
|
||||
|
||||
test('marketplace machine id', () => {
|
||||
const args = ['--user-data-dir', marketplaceHome];
|
||||
const environmentService = new NativeEnvironmentService(parseArgs(args, OPTIONS));
|
||||
const storageService: IStorageService = new TestStorageService();
|
||||
|
||||
return resolveMarketplaceHeaders(product.version, environmentService, fileService, storageService).then(headers => {
|
||||
assert.ok(isUUID(headers['X-Market-User-Id']));
|
||||
|
||||
return resolveMarketplaceHeaders(product.version, environmentService, fileService, storageService).then(headers2 => {
|
||||
assert.equal(headers['X-Market-User-Id'], headers2['X-Market-User-Id']);
|
||||
});
|
||||
});
|
||||
});
|
||||
test('sortByField', () => { // {{SQL CARBON EDIT}} add test
|
||||
let a: {
|
||||
extensionId: string | undefined;
|
||||
extensionName: string | undefined;
|
||||
displayName: string | undefined;
|
||||
shortDescription: string | undefined;
|
||||
publisher: { displayName: string | undefined, publisherId: string | undefined, publisherName: string | undefined; } | undefined;
|
||||
} = {
|
||||
extensionId: undefined,
|
||||
extensionName: undefined,
|
||||
displayName: undefined,
|
||||
shortDescription: undefined,
|
||||
publisher: undefined
|
||||
};
|
||||
let b: {
|
||||
extensionId: string | undefined;
|
||||
extensionName: string | undefined;
|
||||
displayName: string | undefined;
|
||||
shortDescription: string | undefined;
|
||||
publisher: { displayName: string | undefined, publisherId: string | undefined, publisherName: string | undefined; } | undefined;
|
||||
} = {
|
||||
extensionId: undefined,
|
||||
extensionName: undefined,
|
||||
displayName: undefined,
|
||||
shortDescription: undefined,
|
||||
publisher: undefined
|
||||
};
|
||||
|
||||
|
||||
assert.equal(ExtensionGalleryService.compareByField(a.publisher, b.publisher, 'publisherName'), 0);
|
||||
|
||||
a.publisher = { displayName: undefined, publisherId: undefined, publisherName: undefined };
|
||||
assert.equal(ExtensionGalleryService.compareByField(a.publisher, b.publisher, 'publisherName'), 1);
|
||||
|
||||
b.publisher = { displayName: undefined, publisherId: undefined, publisherName: undefined };
|
||||
assert.equal(ExtensionGalleryService.compareByField(a.publisher, b.publisher, 'publisherName'), 0);
|
||||
|
||||
a.publisher.publisherName = 'a';
|
||||
assert.equal(ExtensionGalleryService.compareByField(a.publisher, b.publisher, 'publisherName'), 1);
|
||||
|
||||
b.publisher.publisherName = 'b';
|
||||
assert.equal(ExtensionGalleryService.compareByField(a.publisher, b.publisher, 'publisherName'), -1);
|
||||
|
||||
b.publisher.publisherName = 'a';
|
||||
assert.equal(ExtensionGalleryService.compareByField(a.publisher, b.publisher, 'publisherName'), 0);
|
||||
|
||||
a.displayName = 'test1';
|
||||
assert.equal(ExtensionGalleryService.compareByField(a, b, 'displayName'), 1);
|
||||
|
||||
b.displayName = 'test2';
|
||||
assert.equal(ExtensionGalleryService.compareByField(a, b, 'displayName'), -1);
|
||||
|
||||
b.displayName = 'test1';
|
||||
assert.equal(ExtensionGalleryService.compareByField(a, b, 'displayName'), 0);
|
||||
});
|
||||
|
||||
test('isMatchingExtension', () => { // {{SQL CARBON EDIT}} add test
|
||||
let createEmptyExtension = () => {
|
||||
return {
|
||||
extensionId: '',
|
||||
extensionName: '',
|
||||
displayName: '',
|
||||
shortDescription: '',
|
||||
publisher: {
|
||||
displayName: '',
|
||||
publisherId: '',
|
||||
publisherName: ''
|
||||
},
|
||||
versions: [],
|
||||
statistics: [],
|
||||
flags: ''
|
||||
};
|
||||
};
|
||||
let searchText = 'tExt1 withSpace';
|
||||
let matchingText = 'test text1 Withspace test';
|
||||
let notMatchingText = 'test test';
|
||||
let extension;
|
||||
|
||||
assert(!ExtensionGalleryService.isMatchingExtension(undefined, searchText), 'empty extension should not match any search text');
|
||||
|
||||
extension = createEmptyExtension();
|
||||
assert(ExtensionGalleryService.isMatchingExtension(extension, undefined), 'empty search text should match any not null extension');
|
||||
|
||||
extension = createEmptyExtension();
|
||||
extension.extensionName = notMatchingText;
|
||||
assert(!ExtensionGalleryService.isMatchingExtension(extension, searchText), 'invalid search text should not match extension');
|
||||
|
||||
extension = createEmptyExtension();
|
||||
extension.extensionId = matchingText;
|
||||
assert(ExtensionGalleryService.isMatchingExtension(extension, searchText), 'extensionid field should be used for matching');
|
||||
|
||||
extension = createEmptyExtension();
|
||||
extension.extensionName = matchingText;
|
||||
assert(ExtensionGalleryService.isMatchingExtension(extension, searchText), 'extensionName field should be used for matching');
|
||||
|
||||
extension = createEmptyExtension();
|
||||
extension.displayName = matchingText;
|
||||
assert(ExtensionGalleryService.isMatchingExtension(extension, searchText), 'displayName field should be used for matching');
|
||||
|
||||
extension = createEmptyExtension();
|
||||
extension.shortDescription = matchingText;
|
||||
assert(ExtensionGalleryService.isMatchingExtension(extension, searchText), 'shortDescription field should be used for matching');
|
||||
|
||||
extension = createEmptyExtension();
|
||||
extension.publisher.displayName = matchingText;
|
||||
assert(ExtensionGalleryService.isMatchingExtension(extension, searchText), 'publisher displayName field should be used for matching');
|
||||
|
||||
extension = createEmptyExtension();
|
||||
extension.publisher.publisherName = matchingText;
|
||||
assert(ExtensionGalleryService.isMatchingExtension(extension, searchText), 'publisher publisherName field should be used for matching');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user