This commit is contained in:
Sandeep Somavarapu 2022-02-11 13:13:39 +01:00
parent 7ea160a069
commit c1ae22ad56
No known key found for this signature in database
GPG key ID: 1FED25EC4646638B
2 changed files with 17 additions and 3 deletions

View file

@ -695,6 +695,10 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
this.queryLocal().then(() => {
this.resetIgnoreAutoUpdateExtensions();
this.eventuallyCheckForUpdates(true);
// Always auto update builtin extensions
if (!this.isAutoUpdateEnabled()) {
this.autoUpdateBuiltinExtensions();
}
});
this._register(this.onChange(() => {
@ -994,7 +998,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
return ExtensionState.Uninstalled;
}
async checkForUpdates(): Promise<void> {
async checkForUpdates(onlyBuiltin?: boolean): Promise<void> {
const extensions: Extensions[] = [];
if (this.localExtensions) {
extensions.push(this.localExtensions);
@ -1010,7 +1014,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
}
const infos: IExtensionInfo[] = [];
for (const installed of this.local) {
if (installed.type === ExtensionType.User) {
if (installed.type === ExtensionType.User && (!onlyBuiltin || installed.isBuiltin)) {
infos.push({ ...installed.identifier, preRelease: !!installed.local?.preRelease });
}
}
@ -1070,6 +1074,12 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
.then(undefined, err => null);
}
private async autoUpdateBuiltinExtensions(): Promise<void> {
await this.checkForUpdates(true);
const toUpdate = this.outdated.filter(e => e.isBuiltin);
await Promises.settled(toUpdate.map(e => this.install(e, e.local?.preRelease ? { installPreReleaseVersion: true } : undefined)));
}
private autoUpdateExtensions(): Promise<any> {
if (!this.isAutoUpdateEnabled()) {
return Promise.resolve();

View file

@ -207,6 +207,10 @@ export class WebExtensionsScannerService extends Disposable implements IWebExten
const index = extensions.findIndex(e => e.id === webExtension.identifier.id.toLowerCase() && e.preRelease === webExtension.metadata?.isPreReleaseVersion);
if (index !== -1) {
webExtensions.push(webExtension);
/* Update preRelease flag in the cache - https://github.com/microsoft/vscode/issues/142831 */
if (webExtension.metadata?.isPreReleaseVersion && !webExtension.metadata?.preRelease) {
webExtension.metadata.preRelease = true;
}
extensions.splice(index, 1);
}
}
@ -221,7 +225,7 @@ export class WebExtensionsScannerService extends Disposable implements IWebExten
await Promise.all(galleryExtensions.map(async gallery => {
try {
webExtensions.push(await this.toWebExtensionFromGallery(gallery, { isPreReleaseVersion: gallery.properties.isPreReleaseVersion, isBuiltin: true }));
webExtensions.push(await this.toWebExtensionFromGallery(gallery, { isPreReleaseVersion: gallery.properties.isPreReleaseVersion, preRelease: gallery.properties.isPreReleaseVersion, isBuiltin: true }));
} catch (error) {
this.logService.info(`Ignoring additional builtin extension ${gallery.identifier.id} because there is an error while converting it into web extension`, getErrorMessage(error));
}