From 0f8c669924f829c2b8787b6426161b93167320cd Mon Sep 17 00:00:00 2001 From: Ives van Hoorne Date: Tue, 7 Nov 2023 18:31:00 +0100 Subject: [PATCH] fix: swap toRemove & toAdd in deltaExtensions When we try to remove & add the same extension in a very short timeframe, it does not get initialized properly because it gets both added to `toRemove` and `toAdd`. When that happens, the extension is first added, and then immediately removed. By swapping `toRemove` and `toAdd` we ensure that the extension is first removed, and then newly added. --- src/service-override/extensions.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/service-override/extensions.ts b/src/service-override/extensions.ts index 5c652c79..c8212416 100644 --- a/src/service-override/extensions.ts +++ b/src/service-override/extensions.ts @@ -433,14 +433,14 @@ export class SimpleExtensionService extends AbstractExtensionService implements public async deltaExtensions (toAdd: IExtensionWithExtHostKind[], toRemove: IExtension[]): Promise { const extHostPicker = (this._extensionHostKindPicker as LocalBrowserExtensionHostKindPicker) + for (const extension of toRemove) { + extHostPicker.removeForcedExtensionHostKind(extension.identifier.id) + } for (const extension of toAdd) { if (extension.extHostKind != null) { extHostPicker.setForcedExtensionHostKind(extension.identifier.id, extension.extHostKind) } } - for (const extension of toRemove) { - extHostPicker.removeForcedExtensionHostKind(extension.identifier.id) - } await this._handleDeltaExtensions(new DeltaExtensionsQueueItem(toAdd, toRemove)) }