From a884f6a39df48bcbb2ba3a88f2efe75abe9084e9 Mon Sep 17 00:00:00 2001 From: Aditya Bist Date: Wed, 18 Mar 2020 12:20:07 -0700 Subject: [PATCH] Add ability to scroll horizontally in the server table (#9308) * add to scroll horizontally in the server table * respect workbench tree settings for connections --- .../contrib/objectExplorer/browser/serverTreeView.ts | 5 ++++- .../services/objectExplorer/browser/treeCreationUtils.ts | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/sql/workbench/contrib/objectExplorer/browser/serverTreeView.ts b/src/sql/workbench/contrib/objectExplorer/browser/serverTreeView.ts index bb750a484d..c38ad8d605 100644 --- a/src/sql/workbench/contrib/objectExplorer/browser/serverTreeView.ts +++ b/src/sql/workbench/contrib/objectExplorer/browser/serverTreeView.ts @@ -37,6 +37,7 @@ import { isHidden } from 'sql/base/browser/dom'; import { CommandsRegistry } from 'vs/platform/commands/common/commands'; import { startsWith } from 'vs/base/common/strings'; import { SERVER_GROUP_CONFIG } from 'sql/workbench/services/serverGroup/common/interfaces'; +import { horizontalScrollingKey } from 'vs/platform/list/browser/listService'; /** * ServerTreeview implements the dynamic tree view. @@ -140,7 +141,9 @@ export class ServerTreeView extends Disposable implements IServerTreeView { this._connectionManagementService.showConnectionDialog(); })); } - this._tree = this._register(TreeCreationUtils.createRegisteredServersTree(container, this._instantiationService)); + + const horizontalScrollEnabled: boolean = this._configurationService.getValue(horizontalScrollingKey) || false; + this._tree = this._register(TreeCreationUtils.createRegisteredServersTree(container, this._instantiationService, horizontalScrollEnabled)); //this._tree.setInput(undefined); this._register(this._tree.onDidChangeSelection((event) => this.onSelected(event))); this._register(this._tree.onDidBlur(() => this._onSelectionOrFocusChange.fire())); diff --git a/src/sql/workbench/services/objectExplorer/browser/treeCreationUtils.ts b/src/sql/workbench/services/objectExplorer/browser/treeCreationUtils.ts index 399f9cfa58..c54d0d8b61 100644 --- a/src/sql/workbench/services/objectExplorer/browser/treeCreationUtils.ts +++ b/src/sql/workbench/services/objectExplorer/browser/treeCreationUtils.ts @@ -14,6 +14,7 @@ import { DefaultFilter, DefaultAccessibilityProvider, DefaultController } from ' import { IController } from 'vs/base/parts/tree/browser/tree'; import { ServerTreeDragAndDrop, RecentConnectionsDragAndDrop } from 'sql/workbench/services/objectExplorer/browser/dragAndDropController'; import { RecentConnectionDataSource } from 'sql/workbench/services/objectExplorer/browser/recentConnectionDataSource'; +import { ScrollbarVisibility } from 'vs/base/common/scrollable'; export class TreeCreationUtils { /** @@ -39,7 +40,7 @@ export class TreeCreationUtils { /** * Create a Servers viewlet tree */ - public static createRegisteredServersTree(treeContainer: HTMLElement, instantiationService: IInstantiationService): Tree { + public static createRegisteredServersTree(treeContainer: HTMLElement, instantiationService: IInstantiationService, horizontalScrollMode: boolean = false): Tree { const dataSource = instantiationService.createInstance(ServerTreeDataSource); const actionProvider = instantiationService.createInstance(ServerTreeActionProvider); @@ -54,7 +55,8 @@ export class TreeCreationUtils { { indentPixels: 10, twistiePixels: 20, - ariaLabel: nls.localize('treeCreation.regTreeAriaLabel', "Servers") + ariaLabel: nls.localize('treeCreation.regTreeAriaLabel', "Servers"), + horizontalScrollMode: horizontalScrollMode ? ScrollbarVisibility.Auto : ScrollbarVisibility.Hidden }); } }