Preference Modification #9880
-
Hi All, Thanks The following would be my custom CorePreference. import { CorePreferences, createPreferenceProxy, PreferenceContribution, PreferenceProxy, PreferenceSchema, PreferenceService } from '@theia/core/lib/browser';
import { interfaces } from 'inversify';
export const corePreferenceSchema: PreferenceSchema = {
'type': 'object',
properties: {
'workbench.list.openMode': {
type: 'string',
enum: [
'singleClick',
'doubleClick'
],
default: 'singleClick',
description: 'Controls how to open items in trees using the mouse.'
},
'workbench.editor.highlightModifiedTabs': {
'type': 'boolean',
'description': 'Controls whether a top border is drawn on modified (dirty) editor tabs or not.',
'default': false
},
'workbench.editor.closeOnFileDelete': {
'type': 'boolean',
// eslint-disable-next-line max-len
'description': 'Controls whether editors showing a file that was opened during the session should close automatically when getting deleted or renamed by some other process. Disabling this will keep the editor open on such an event. Note that deleting from within the application will always close the editor and that dirty files will never close to preserve your data.',
'default': true
},
'application.confirmExit': {
type: 'string',
enum: [
'never',
'ifRequired',
'always',
],
default: 'ifRequired',
description: 'When to confirm before closing the application window.',
},
'workbench.silentNotifications': {
type: 'boolean',
default: false,
description: 'Controls whether to suppress notification popups.'
},
'workbench.tree.renderIndentGuides': {
type: 'string',
enum: ['onHover', 'none', 'always'],
default: 'onHover',
description: 'Controls whether the tree should render indent guides.'
},
'keyboard.dispatch': {
type: 'string',
enum: [
'code',
'keyCode',
],
default: 'code',
description: 'Whether to interpret keypresses by the `code` of the physical key, or by the `keyCode` provided by the OS.'
},
}
};
export interface CoreConfiguration {
'application.confirmExit': 'never' | 'ifRequired' | 'always';
'keyboard.dispatch': 'code' | 'keyCode';
'workbench.list.openMode': 'singleClick' | 'doubleClick';
'workbench.commandPalette.history': number;
'workbench.editor.highlightModifiedTabs': boolean;
'workbench.editor.closeOnFileDelete': boolean;
'workbench.colorTheme': string;
'workbench.iconTheme': string | null;
'workbench.silentNotifications': boolean;
'files.encoding': string
'workbench.tree.renderIndentGuides': 'onHover' | 'none' | 'always';
}
export const CorePreferences1 = Symbol('CorePreferences');
export type CorePreferences1 = PreferenceProxy<CoreConfiguration>;
export function createCorePreferences(preferences: PreferenceService): CorePreferences {
return createPreferenceProxy(preferences, corePreferenceSchema);
}
export function bindCorePreferences1(bind: interfaces.Bind): void {
bind(CorePreferences1).toDynamicValue(ctx => {
const preferences = ctx.container.get<PreferenceService>(PreferenceService);
return createCorePreferences(preferences);
}).inSingletonScope();
bind(PreferenceContribution).toConstantValue({ schema: corePreferenceSchema });
} |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 12 replies
-
@maheshrajrp I'm not sure I follow as to why you would want to |
Beta Was this translation helpful? Give feedback.
-
export const CorePreferences1 = Symbol('CorePreferences'); You are creating a new |
Beta Was this translation helpful? Give feedback.
-
Hi @vince-fugnitto , Thanks for the fix. I was hoping to try this one out. However, was unable to locate "WorkspacePreferencesSchemaProvider" which is mentioned in c5a7d71 Thanks |
Beta Was this translation helpful? Give feedback.
-
In case others are looking for an example: |
Beta Was this translation helpful? Give feedback.
In case others are looking for an example: