Skip to content

Commit

Permalink
Handle top-level preference access from plugins (#12056)
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-grant-work authored Jan 11, 2023
1 parent 5bafaa5 commit c5e48b5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/plugin-ext/src/plugin/preference-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,17 @@ export class PreferenceRegistryExtImpl implements PreferenceRegistryExt {
},
update: (key: string, value: any, targetScope?: ConfigurationTarget | boolean, withLanguageOverride?: boolean): PromiseLike<void> => {
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 {
return this.proxy.$removeConfigurationOption(targetScope, fullPath, resourceStr, withLanguageOverride);
}
},
inspect: <T>(key: string): ConfigurationInspect<T> | undefined => {
const path = `${rawSection}.${key}`;
const path = rawSection ? `${rawSection}.${key}` : key;
const result = this._preferences.inspect<T>(path, overrides, new TheiaWorkspace(this.workspace));

if (!result) {
Expand Down

0 comments on commit c5e48b5

Please sign in to comment.