diff --git a/packages/vsx-registry/src/browser/vsx-extensions-model.ts b/packages/vsx-registry/src/browser/vsx-extensions-model.ts index e60a61f589e4a..bbaed3b7935a5 100644 --- a/packages/vsx-registry/src/browser/vsx-extensions-model.ts +++ b/packages/vsx-registry/src/browser/vsx-extensions-model.ts @@ -219,6 +219,10 @@ export class VSXExtensionsModel { protected async refresh(id: string): Promise { try { + let extension = this.getExtension(id); + if (!this.shouldRefresh(extension)) { + return extension; + } const data = await this.api.getLatestCompatibleExtensionVersion(id); if (!data) { return; @@ -226,7 +230,7 @@ export class VSXExtensionsModel { if (data.error) { return this.onDidFailRefresh(id, data.error); } - const extension = this.setExtension(id); + extension = this.setExtension(id); extension.update(Object.assign(data, { publisher: data.namespace, downloadUrl: data.files.download, @@ -241,6 +245,17 @@ export class VSXExtensionsModel { } } + /** + * Determines if the given extension should be refreshed. + * @param extension the extension to refresh. + */ + protected shouldRefresh(extension?: VSXExtension): boolean { + if (extension === undefined) { + return true; + } + return !extension.builtin; + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any protected onDidFailRefresh(id: string, error: any): VSXExtension | undefined { const cached = this.getExtension(id); diff --git a/packages/vsx-registry/src/common/vsx-registry-api.ts b/packages/vsx-registry/src/common/vsx-registry-api.ts index 28ba7878b9992..7158d5e5df880 100644 --- a/packages/vsx-registry/src/common/vsx-registry-api.ts +++ b/packages/vsx-registry/src/common/vsx-registry-api.ts @@ -41,11 +41,6 @@ export namespace VSXResponseError { } } -/** - * Namespace reserved for vscode builtin extensions. - */ -const VSCODE_NAMESPACE = 'vscode'; - @injectable() export class VSXRegistryAPI { @@ -145,10 +140,7 @@ export class VSXRegistryAPI { const extensions = await this.getAllVersions(id); for (let i = 0; i < extensions.length; i++) { const extension: VSXExtensionRaw = extensions[i]; - // Skip vscode builtin extensions. - if (extension.namespace === VSCODE_NAMESPACE) { - return extension; - } else if (extension.engines && this.isEngineSupported(extension.engines.vscode)) { + if (extension.engines && this.isEngineSupported(extension.engines.vscode)) { return extension; } }