From 221d90e420f47b7ef13e0ee3b52c8301c1e3df63 Mon Sep 17 00:00:00 2001 From: seantan22 Date: Mon, 22 Mar 2021 11:33:38 -0400 Subject: [PATCH] VSX: Keep Recently Uninstalled Extensions in View What It Does - Keeps recently uninstalled extensions present in the `installed` part of the extensions-view until reload How To Test 1. Open the extensions view. 2. Select an extension and click `Uninstall`. 3. Observe that the extension remains in the `installed` part of the view and can be re-installed if needed. 4. Reload the view and observe that the recently uninstalled extension has been removed. Signed-off-by: seantan22 --- packages/vsx-registry/src/browser/vsx-extensions-model.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/vsx-registry/src/browser/vsx-extensions-model.ts b/packages/vsx-registry/src/browser/vsx-extensions-model.ts index b011688b4849b..e60a61f589e4a 100644 --- a/packages/vsx-registry/src/browser/vsx-extensions-model.ts +++ b/packages/vsx-registry/src/browser/vsx-extensions-model.ts @@ -158,16 +158,17 @@ export class VSXExtensionsModel { } protected async updateInstalled(): Promise { + const prevInstalled = this._installed; return this.doChange(async () => { const plugins = this.pluginSupport.plugins; - const installed = new Set(); + const currInstalled = new Set(); const refreshing = []; for (const plugin of plugins) { if (plugin.model.engine.type === 'vscode') { const id = plugin.model.id; this._installed.delete(id); const extension = this.setExtension(id); - installed.add(extension.id); + currInstalled.add(extension.id); refreshing.push(this.refresh(id)); } } @@ -175,6 +176,7 @@ export class VSXExtensionsModel { refreshing.push(this.refresh(id)); } Promise.all(refreshing); + const installed = new Set([...prevInstalled, ...currInstalled]); const installedSorted = Array.from(installed).sort((a, b) => this.compareExtensions(a, b)); this._installed = new Set(installedSorted.values()); });