提交 6e9fe5a6 编写于 作者: J João Moreno

fixes #71994

上级 a25c5efd
......@@ -954,6 +954,7 @@ export interface IAbstractTreeOptionsUpdate extends ITreeRendererOptions {
readonly smoothScrolling?: boolean;
readonly horizontalScrolling?: boolean;
readonly expandOnlyOnDoubleClick?: boolean;
readonly expandOnlyOnTwistieClick?: boolean | ((e: any) => boolean); // e is T
}
export interface IAbstractTreeOptions<T, TFilterData = void> extends IAbstractTreeOptionsUpdate, IListOptions<T> {
......@@ -961,7 +962,6 @@ export interface IAbstractTreeOptions<T, TFilterData = void> extends IAbstractTr
readonly filter?: ITreeFilter<T, TFilterData>;
readonly dnd?: ITreeDragAndDrop<T>;
readonly keyboardNavigationEventFilter?: IKeyboardNavigationEventFilter;
readonly expandOnlyOnTwistieClick?: boolean | ((e: T) => boolean);
readonly additionalScrollHeight?: number;
}
......
......@@ -126,6 +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';
function useAltAsMultipleSelectionModifier(configurationService: IConfigurationService): boolean {
return configurationService.getValue(multiSelectModifierSettingKey) === 'alt';
......@@ -831,7 +832,8 @@ function workbenchTreeDataPreamble<T, TFilterData, TOptions extends IAbstractTre
keyboardNavigationEventFilter: createKeyboardNavigationEventFilter(container, keybindingService),
additionalScrollHeight,
hideTwistiesOfChildlessElements: options.hideTwistiesOfChildlessElements,
expandOnlyOnDoubleClick: configurationService.getValue(openModeSettingKey) === 'doubleClick'
expandOnlyOnDoubleClick: configurationService.getValue(openModeSettingKey) === 'doubleClick',
expandOnlyOnTwistieClick: !configurationService.getValue<boolean>(treeExpandOnFolderClick)
} as TOptions
};
}
......@@ -933,6 +935,9 @@ class WorkbenchTreeInternals<TInput, T, TFilterData> {
if (e.affectsConfiguration(openModeSettingKey)) {
newOptions = { ...newOptions, expandOnlyOnDoubleClick: configurationService.getValue(openModeSettingKey) === 'doubleClick' };
}
if (e.affectsConfiguration(treeExpandOnFolderClick)) {
newOptions = { ...newOptions, expandOnlyOnTwistieClick: !configurationService.getValue<boolean>(treeExpandOnFolderClick) };
}
if (Object.keys(newOptions).length > 0) {
tree.updateOptions(newOptions);
}
......@@ -1036,6 +1041,11 @@ configurationRegistry.registerConfiguration({
'type': 'boolean',
'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."),
}
}
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册