From cbab504ea938e21ccf388e4b5f6a7df19600d3df Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 2 Dec 2021 09:23:33 +0100 Subject: [PATCH] Update editor configuration only after extensions are registered (#138302) * delay updating editor configurations when installe extensions are registered * async function over Promise.then Co-authored-by: Benjamin Pasero --- .../browser/parts/editor/editorConfiguration.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/editorConfiguration.ts b/src/vs/workbench/browser/parts/editor/editorConfiguration.ts index e452fbb1a54..5812b5340e3 100644 --- a/src/vs/workbench/browser/parts/editor/editorConfiguration.ts +++ b/src/vs/workbench/browser/parts/editor/editorConfiguration.ts @@ -11,6 +11,7 @@ import { IConfigurationRegistry, Extensions as ConfigurationExtensions, IConfigu import { workbenchConfigurationNodeBase } from 'vs/workbench/common/configuration'; import { IEditorResolverService, RegisteredEditorInfo, RegisteredEditorPriority } from 'vs/workbench/services/editor/common/editorResolverService'; import { IJSONSchemaMap } from 'vs/base/common/jsonSchema'; +import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; export class DynamicEditorGroupAutoLockConfiguration extends Disposable implements IWorkbenchContribution { @@ -32,12 +33,21 @@ export class DynamicEditorGroupAutoLockConfiguration extends Disposable implemen private configurationNode: IConfigurationNode | undefined; constructor( - @IEditorResolverService private readonly editorResolverService: IEditorResolverService + @IEditorResolverService private readonly editorResolverService: IEditorResolverService, + @IExtensionService extensionService: IExtensionService, ) { super(); - this.updateConfiguration(); - this.registerListeners(); + // Editor configurations are getting updated very aggressively + // (atleast 20 times) while the extensions are getting registered. + // As such push out the dynamic editor auto lock configuration + // until after extensions registered. + (async ()=> { + await extensionService.whenInstalledExtensionsRegistered(); + + this.updateConfiguration(); + this.registerListeners(); + })(); } private registerListeners(): void {