Skip to content

Commit c5e48b5

Browse files
author
colin-grant-work
authored
Handle top-level preference access from plugins (eclipse-theia#12056)
1 parent 5bafaa5 commit c5e48b5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/plugin-ext/src/plugin/preference-registry.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,17 @@ export class PreferenceRegistryExtImpl implements PreferenceRegistryExt {
170170
},
171171
update: (key: string, value: any, targetScope?: ConfigurationTarget | boolean, withLanguageOverride?: boolean): PromiseLike<void> => {
172172
const resourceStr = overrides.resource?.toString();
173-
const fullPath = `${overrides.overrideIdentifier ? `[${overrides.overrideIdentifier}].` : ''}${rawSection}.${key}`;
173+
const overrideSegment = overrides.overrideIdentifier ? `[${overrides.overrideIdentifier}].` : '';
174+
const preferenceKey = rawSection ? `${rawSection}.${key}` : key;
175+
const fullPath = overrideSegment + preferenceKey;
174176
if (typeof value !== 'undefined') {
175177
return this.proxy.$updateConfigurationOption(targetScope, fullPath, value, resourceStr, withLanguageOverride);
176178
} else {
177179
return this.proxy.$removeConfigurationOption(targetScope, fullPath, resourceStr, withLanguageOverride);
178180
}
179181
},
180182
inspect: <T>(key: string): ConfigurationInspect<T> | undefined => {
181-
const path = `${rawSection}.${key}`;
183+
const path = rawSection ? `${rawSection}.${key}` : key;
182184
const result = this._preferences.inspect<T>(path, overrides, new TheiaWorkspace(this.workspace));
183185

184186
if (!result) {

0 commit comments

Comments
 (0)