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

create setting for list type navigation mode #169925

Merged
merged 1 commit into from Dec 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 21 additions & 2 deletions src/vs/platform/list/browser/listService.ts
Expand Up @@ -144,7 +144,8 @@ const multiSelectModifierSettingKey = 'workbench.list.multiSelectModifier';
const openModeSettingKey = 'workbench.list.openMode';
const horizontalScrollingKey = 'workbench.list.horizontalScrolling';
const defaultFindModeSettingKey = 'workbench.list.defaultFindMode';
/** @deprecated in favor of workbench.list.defaultFindMode */
const typeNavigationModeSettingKey = 'workbench.list.typeNavigationMode';
/** @deprecated in favor of `workbench.list.defaultFindMode` and `workbench.list.typeNavigationMode` */
const keyboardNavigationSettingKey = 'workbench.list.keyboardNavigation';
const treeIndentKey = 'workbench.tree.indent';
const treeRenderIndentGuidesKey = 'workbench.tree.renderIndentGuides';
Expand Down Expand Up @@ -1102,6 +1103,15 @@ function workbenchTreeDataPreamble<T, TFilterData, TOptions extends IAbstractTre
return TypeNavigationMode.Trigger;
}

// finally, check the setting
const configString = configurationService.getValue<'automatic' | 'trigger'>(typeNavigationModeSettingKey);

if (configString === 'automatic') {
return TypeNavigationMode.Automatic;
} else if (configString === 'trigger') {
return TypeNavigationMode.Trigger;
}

return undefined;
};

Expand Down Expand Up @@ -1251,6 +1261,9 @@ class WorkbenchTreeInternals<TInput, T, TFilterData> {
if (e.affectsConfiguration(defaultFindModeSettingKey) || e.affectsConfiguration(keyboardNavigationSettingKey)) {
tree.updateOptions({ defaultFindMode: getDefaultTreeFindMode(configurationService) });
}
if (e.affectsConfiguration(typeNavigationModeSettingKey) || e.affectsConfiguration(keyboardNavigationSettingKey)) {
tree.updateOptions({ typeNavigationMode: getTypeNavigationMode() });
}
if (e.affectsConfiguration(horizontalScrollingKey) && options.horizontalScrolling === undefined) {
const horizontalScrolling = Boolean(configurationService.getValue(horizontalScrollingKey));
newOptions = { ...newOptions, horizontalScrolling };
Expand Down Expand Up @@ -1390,13 +1403,19 @@ configurationRegistry.registerConfiguration({
default: 'highlight',
description: localize('keyboardNavigationSettingKey', "Controls the keyboard navigation style for lists and trees in the workbench. Can be simple, highlight and filter."),
deprecated: true,
deprecationMessage: localize('keyboardNavigationSettingKeyDeprecated', "Please use 'workbench.list.defaultFindMode' instead.")
deprecationMessage: localize('keyboardNavigationSettingKeyDeprecated', "Please use 'workbench.list.defaultFindMode' and 'workbench.list.typeNavigationMode' instead.")
},
[treeExpandMode]: {
type: 'string',
enum: ['singleClick', 'doubleClick'],
default: 'singleClick',
description: localize('expand mode', "Controls how tree folders are expanded when clicking the folder names. Note that some trees and lists might choose to ignore this setting if it is not applicable."),
},
[typeNavigationModeSettingKey]: {
type: 'string',
enum: ['automatic', 'trigger'],
default: 'automatic',
description: localize('typeNavigationMode', "Controls the how type navigation works in lists and trees in the workbench. When set to 'trigger', type navigation begins once the 'list.triggerTypeNavigation' command is run."),
}
}
});