workbench.tree.expandMode

related to #95697
This commit is contained in:
João Moreno 2020-12-02 16:31:21 +01:00
parent 49ef641300
commit 97646e138a
No known key found for this signature in database
GPG key ID: 896B853774D1A575

View file

@ -126,7 +126,7 @@ const automaticKeyboardNavigationSettingKey = 'workbench.list.automaticKeyboardN
const treeIndentKey = 'workbench.tree.indent';
const treeRenderIndentGuidesKey = 'workbench.tree.renderIndentGuides';
const listSmoothScrolling = 'workbench.list.smoothScrolling';
const treeExpandOnFolderClick = 'workbench.tree.expandOnFolderClick';
const treeExpandMode = 'workbench.tree.expandMode';
function useAltAsMultipleSelectionModifier(configurationService: IConfigurationService): boolean {
return configurationService.getValue(multiSelectModifierSettingKey) === 'alt';
@ -849,7 +849,7 @@ function workbenchTreeDataPreamble<T, TFilterData, TOptions extends IAbstractTre
additionalScrollHeight,
hideTwistiesOfChildlessElements: options.hideTwistiesOfChildlessElements,
expandOnlyOnDoubleClick: configurationService.getValue(openModeSettingKey) === 'doubleClick',
expandOnlyOnTwistieClick: options.expandOnlyOnTwistieClick ?? !configurationService.getValue<boolean>(treeExpandOnFolderClick)
expandOnlyOnTwistieClick: options.expandOnlyOnTwistieClick ?? (configurationService.getValue<'singleClick' | 'doubleClick'>(treeExpandMode) === 'doubleClick')
} as TOptions
};
}
@ -951,8 +951,8 @@ class WorkbenchTreeInternals<TInput, T, TFilterData> {
if (e.affectsConfiguration(openModeSettingKey)) {
newOptions = { ...newOptions, expandOnlyOnDoubleClick: configurationService.getValue(openModeSettingKey) === 'doubleClick' };
}
if (e.affectsConfiguration(treeExpandOnFolderClick) && options.expandOnlyOnTwistieClick === undefined) {
newOptions = { ...newOptions, expandOnlyOnTwistieClick: !configurationService.getValue<boolean>(treeExpandOnFolderClick) };
if (e.affectsConfiguration(treeExpandMode) && options.expandOnlyOnTwistieClick === undefined) {
newOptions = { ...newOptions, expandOnlyOnTwistieClick: configurationService.getValue<'singleClick' | 'doubleClick'>(treeExpandMode) === 'doubleClick' };
}
if (Object.keys(newOptions).length > 0) {
tree.updateOptions(newOptions);
@ -1058,10 +1058,11 @@ configurationRegistry.registerConfiguration({
'default': true,
markdownDescription: localize('automatic keyboard navigation setting', "Controls whether keyboard navigation in lists and trees is automatically triggered simply by typing. If set to `false`, keyboard navigation is only triggered when executing the `list.toggleKeyboardNavigation` command, for which you can assign a keyboard shortcut.")
},
[treeExpandOnFolderClick]: {
type: 'boolean',
default: true,
description: localize('list expand on folder click setting', "Controls whether tree folders are expanded when clicking the folder names."),
[treeExpandMode]: {
type: 'string',
enum: ['singleClick', 'doubleClick'],
default: 'singleClick',
description: localize('expand mode', "Controls how tree folders are expanded when clicking the folder names."),
}
}
});