From 5473f5da51ee87280bfd12e1f4d9cd34ac1ba8aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=A4der?= Date: Mon, 5 Feb 2024 16:34:34 +0100 Subject: [PATCH] Fix performance problem when creating standalone editor. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Mäder --- packages/monaco/src/browser/monaco-frontend-module.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/monaco/src/browser/monaco-frontend-module.ts b/packages/monaco/src/browser/monaco-frontend-module.ts index 3ee1161430663..0bee7f59228b4 100644 --- a/packages/monaco/src/browser/monaco-frontend-module.ts +++ b/packages/monaco/src/browser/monaco-frontend-module.ts @@ -215,6 +215,14 @@ export function createMonacoConfigurationService(container: interfaces.Container return proxy; }; + /* + * Since we never read values from the underlying service, writing to it doesn't make sense. The standalone editor writes to the configuration when being created, + * which makes sense in the standalone case where there is no preference infrastructure in place. Those writes degrade the performance, however, so we patch the + * service to an empty implementation. + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + service.updateValues = (values: [string, any][]) => Promise.resolve(); + const toTarget = (scope: PreferenceScope): ConfigurationTarget => { switch (scope) { case PreferenceScope.Default: return ConfigurationTarget.DEFAULT;