Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle top-level preference access from plugins #12056

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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