src/vs/platform/extensionManagement/node/extensionsScanner.ts/ExtensionsScanner/removeOutdatedExtensions
class ExtensionsScanner:	private async removeOutdatedExtensions(): Promise<void> {
		const extensions = await this.extensionsScannerService.scanUserExtensions({ includeAllVersions: true, includeUninstalled: true, includeInvalid: true }); // All user extensions
		const toRemove: IScannedExtension[] = [];

		// Outdated extensions
		const targetPlatform = await this.extensionsScannerService.getTargetPlatform();
		const byExtension = groupByExtension(extensions, e => e.identifier);
		toRemove.push(...flatten(byExtension.map(p => p.sort((a, b) => {
			const vcompare = semver.rcompare(a.manifest.version, b.manifest.version);
			if (vcompare !== 0) {
				return vcompare;
			}
			if (a.targetPlatform === targetPlatform) {
				return -1;
			}
			return 1;
		}).slice(1))));

		await Promises.settled(toRemove.map(extension => this.removeExtension(extension, 'outdated')));
	}