From adc29425ae012b525d36bb420983a605003b663f Mon Sep 17 00:00:00 2001 From: Colin Grant Date: Tue, 10 Jan 2023 10:11:48 -0700 Subject: [PATCH] Handle top-level preference access from plugins --- packages/plugin-ext/src/plugin/preference-registry.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/plugin-ext/src/plugin/preference-registry.ts b/packages/plugin-ext/src/plugin/preference-registry.ts index 275883fe8d924..63cc7efa4ecb9 100644 --- a/packages/plugin-ext/src/plugin/preference-registry.ts +++ b/packages/plugin-ext/src/plugin/preference-registry.ts @@ -170,7 +170,9 @@ export class PreferenceRegistryExtImpl implements PreferenceRegistryExt { }, update: (key: string, value: any, targetScope?: ConfigurationTarget | boolean, withLanguageOverride?: boolean): PromiseLike => { const resourceStr = overrides.resource?.toString(); - const fullPath = `${overrides.overrideIdentifier ? `[${overrides.overrideIdentifier}].` : ''}${rawSection}.${key}`; + const overrideSegment = overrides.overrideIdentifier ? `[${overrides.overrideIdentifier}].` : ''; + const preferenceKey = rawSection ? `${rawSection}.${key}` : key; + const fullPath = overrideSegment + preferenceKey; if (typeof value !== 'undefined') { return this.proxy.$updateConfigurationOption(targetScope, fullPath, value, resourceStr, withLanguageOverride); } else { @@ -178,7 +180,7 @@ export class PreferenceRegistryExtImpl implements PreferenceRegistryExt { } }, inspect: (key: string): ConfigurationInspect | undefined => { - const path = `${rawSection}.${key}`; + const path = rawSection ? `${rawSection}.${key}` : key; const result = this._preferences.inspect(path, overrides, new TheiaWorkspace(this.workspace)); if (!result) {