Skip to content

Commit

Permalink
workbench.tree.indent
Browse files Browse the repository at this point in the history
fixes #35447
  • Loading branch information
isidorn committed Jan 17, 2019
1 parent 041b532 commit 24b75da
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/vs/platform/list/browser/listService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ function createScopedContextKeyService(contextKeyService: IContextKeyService, wi
export const multiSelectModifierSettingKey = 'workbench.list.multiSelectModifier';
export const openModeSettingKey = 'workbench.list.openMode';
export const horizontalScrollingKey = 'workbench.tree.horizontalScrolling';
const treeIndentKey = 'workbench.tree.indent';

function useAltAsMultipleSelectionModifier(configurationService: IConfigurationService): boolean {
return configurationService.getValue(multiSelectModifierSettingKey) === 'alt';
Expand Down Expand Up @@ -908,7 +909,8 @@ export class WorkbenchObjectTree<T extends NonNullable<any>, TFilterData = void>
keyboardSupport: false,
styleController: new DefaultStyleController(getSharedListStyleSheet()),
...computeStyles(themeService.getTheme(), defaultListStyles),
...toWorkbenchListOptions(options, configurationService, keybindingService)
...toWorkbenchListOptions(options, configurationService, keybindingService),
indent: configurationService.getValue(treeIndentKey)
});

this.contextKeyService = createScopedContextKeyService(contextKeyService, this);
Expand Down Expand Up @@ -944,6 +946,10 @@ export class WorkbenchObjectTree<T extends NonNullable<any>, TFilterData = void>
if (e.affectsConfiguration(multiSelectModifierSettingKey)) {
this._useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(configurationService);
}
if (e.affectsConfiguration(treeIndentKey)) {
const indent = configurationService.getValue<number>(treeIndentKey);
this.updateOptions({ indent });
}
})
);
}
Expand Down Expand Up @@ -1055,7 +1061,8 @@ export class WorkbenchAsyncDataTree<TInput, T, TFilterData = void> extends Async
keyboardSupport: false,
styleController: new DefaultStyleController(getSharedListStyleSheet()),
...computeStyles(themeService.getTheme(), defaultListStyles),
...toWorkbenchListOptions(options, configurationService, keybindingService)
...toWorkbenchListOptions(options, configurationService, keybindingService),
indent: configurationService.getValue<number>(treeIndentKey)
});

this.contextKeyService = createScopedContextKeyService(contextKeyService, this);
Expand Down Expand Up @@ -1091,6 +1098,10 @@ export class WorkbenchAsyncDataTree<TInput, T, TFilterData = void> extends Async
if (e.affectsConfiguration(multiSelectModifierSettingKey)) {
this._useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(configurationService);
}
if (e.affectsConfiguration(treeIndentKey)) {
const indent = configurationService.getValue<number>(treeIndentKey);
this.updateOptions({ indent });
}
})
);
}
Expand Down Expand Up @@ -1137,6 +1148,11 @@ configurationRegistry.registerConfiguration({
'type': 'boolean',
'default': false,
'description': localize('horizontalScrolling setting', "Controls whether trees support horizontal scrolling in the workbench.")
},
[treeIndentKey]: {
'type': 'number',
'default': 8,
'description': localize('tree indent setting', "Controls tree indentation in pixels.")
}
}
});

0 comments on commit 24b75da

Please sign in to comment.