fix #183837
This commit is contained in:
Sandeep Somavarapu 2023-05-31 15:45:24 +02:00 committed by GitHub
parent 1b01ed010e
commit 207c1b956e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 5 deletions

View file

@ -857,9 +857,12 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
// Check for updates
this.eventuallyCheckForUpdates(true);
// Always auto update builtin extensions in web
if (isWeb && !this.isAutoUpdateEnabled()) {
this.autoUpdateBuiltinExtensions();
if (isWeb) {
this.syncPinnedBuiltinExtensions();
// Always auto update builtin extensions in web
if (!this.isAutoUpdateEnabled()) {
this.autoUpdateBuiltinExtensions();
}
}
}
@ -1333,7 +1336,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
// Skip if check updates only for builtin extensions and current extension is not builtin.
continue;
}
if (installed.isBuiltin && (installed.type === ExtensionType.System || !installed.local?.identifier.uuid)) {
if (installed.isBuiltin && !installed.pinned && (installed.type === ExtensionType.System || !installed.local?.identifier.uuid)) {
// Skip checking updates for a builtin extension if it is a system extension or if it does not has Marketplace identifier
continue;
}
@ -1412,6 +1415,21 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
await Promises.settled(toUpdate.map(e => this.install(e, e.local?.preRelease ? { installPreReleaseVersion: true } : undefined)));
}
private async syncPinnedBuiltinExtensions(): Promise<void> {
const infos: IExtensionInfo[] = [];
for (const installed of this.local) {
if (installed.isBuiltin && installed.pinned && installed.local?.identifier.uuid) {
infos.push({ ...installed.identifier, version: installed.version });
}
}
if (infos.length) {
const galleryExtensions = await this.galleryService.getExtensions(infos, CancellationToken.None);
if (galleryExtensions.length) {
await this.syncInstalledExtensionsWithGallery(galleryExtensions);
}
}
}
private autoUpdateExtensions(): Promise<any> {
if (!this.isAutoUpdateEnabled()) {
return Promise.resolve();

View file

@ -385,9 +385,10 @@ export class WebExtensionsScannerService extends Disposable implements IWebExten
if (webExtension) {
result.set(galleryExtension.identifier.id.toLowerCase(), {
...webExtension,
identifier: { id: webExtension.identifier.id, uuid: galleryExtension.identifier.uuid },
readmeUri: galleryExtension.assets.readme ? URI.parse(galleryExtension.assets.readme.uri) : undefined,
changelogUri: galleryExtension.assets.changelog ? URI.parse(galleryExtension.assets.changelog.uri) : undefined,
metadata: { isPreReleaseVersion: galleryExtension.properties.isPreReleaseVersion, preRelease: galleryExtension.properties.isPreReleaseVersion, isBuiltin: true }
metadata: { isPreReleaseVersion: galleryExtension.properties.isPreReleaseVersion, preRelease: galleryExtension.properties.isPreReleaseVersion, isBuiltin: true, pinned: true }
});
}
}