Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 authored May 31, 2023
1 parent 1b01ed0 commit 207c1b9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
});
}
}
Expand Down

0 comments on commit 207c1b9

Please sign in to comment.