Repository: microsoft/vscode (TypeScript)
Date: 2022-03-16 17:34:08+00:00
Task type: Feature

Issue:
Ability to update built in extensions
Ability to update built in extensions


Issue discussion:
This is a pre-request to enable built-in extension to on-board to [insiders extensions](https://github.com/microsoft/vscode/issues/15756)

Solution patch:
diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts b/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts
--- a/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts
+++ b/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts
@@ -749,13 +749,6 @@ export class UpdateAction extends ExtensionAction {
 			return;
 		}
 
-		if (this.extension.type !== ExtensionType.User) {
-			this.enabled = false;
-			this.class = UpdateAction.DisabledClass;
-			this.label = this.getLabel();
-			return;
-		}
-
 		const canInstall = await this.extensionsWorkbenchService.canInstall(this.extension);
 		const isInstalled = this.extension.state === ExtensionState.Installed;
 
diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts b/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
--- a/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
+++ b/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
@@ -45,6 +45,7 @@ import { isBoolean, isUndefined } from 'vs/base/common/types';
 import { IExtensionManifestPropertiesService } from 'vs/workbench/services/extensions/common/extensionManifestPropertiesService';
 import { IExtensionService, IExtensionsStatus } from 'vs/workbench/services/extensions/common/extensions';
 import { ExtensionEditor } from 'vs/workbench/contrib/extensions/browser/extensionEditor';
+import { isWeb } from 'vs/base/common/platform';
 
 interface IExtensionStateProvider<T> {
 	(extension: Extension): T;
@@ -205,9 +206,6 @@ export class Extension implements IExtension {
 		if (!this.gallery || !this.local) {
 			return false;
 		}
-		if (this.type !== ExtensionType.User) {
-			return false;
-		}
 		if (!this.local.preRelease && this.gallery.properties.isPreReleaseVersion) {
 			return false;
 		}
@@ -718,8 +716,8 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
 		this.queryLocal().then(() => {
 			this.resetIgnoreAutoUpdateExtensions();
 			this.eventuallyCheckForUpdates(true);
-			// Always auto update builtin extensions
-			if (!this.isAutoUpdateEnabled()) {
+			// Always auto update builtin extensions in web
+			if (isWeb && !this.isAutoUpdateEnabled()) {
 				this.autoUpdateBuiltinExtensions();
 			}
 		});
@@ -1055,7 +1053,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
 		}
 		const infos: IExtensionInfo[] = [];
 		for (const installed of this.local) {
-			if (installed.type === ExtensionType.User && (!onlyBuiltin || installed.isBuiltin)) {
+			if (!onlyBuiltin || installed.isBuiltin) {
 				infos.push({ ...installed.identifier, preRelease: !!installed.local?.preRelease });
 			}
 		}


Test patch:
diff --git a/src/vs/workbench/contrib/extensions/test/electron-browser/extension.test.ts b/src/vs/workbench/contrib/extensions/test/electron-browser/extension.test.ts
--- a/src/vs/workbench/contrib/extensions/test/electron-browser/extension.test.ts
+++ b/src/vs/workbench/contrib/extensions/test/electron-browser/extension.test.ts
@@ -46,9 +46,9 @@ suite('Extension Test', () => {
 		assert.strictEqual(extension.outdated, true);
 	});
 
-	test('extension is not outdated when local is built in and older than gallery', () => {
+	test('extension is outdated when local is built in and older than gallery', () => {
 		const extension = instantiationService.createInstance(Extension, () => ExtensionState.Installed, undefined, aLocalExtension('somext', { version: '1.0.0' }, { type: ExtensionType.System }), aGalleryExtension('somext', { version: '1.0.1' }));
-		assert.strictEqual(extension.outdated, false);
+		assert.strictEqual(extension.outdated, true);
 	});
 
 	test('extension is outdated when local and gallery are on same version but on different target platforms', () => {