add sorting option for saved connections (#15229)

* add sort by name option for saved connections and groups
This commit is contained in:
Hai Cao
2021-04-28 11:41:09 -07:00
committed by GitHub
parent 13ab2bc487
commit 9bc1797e88
5 changed files with 128 additions and 6 deletions

View File

@@ -41,6 +41,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { AsyncServerTree, ServerTreeElement } from 'sql/workbench/services/objectExplorer/browser/asyncServerTree';
import { coalesce } from 'vs/base/common/arrays';
import { CONNECTIONS_SORT_BY_CONFIG_KEY } from 'sql/platform/connection/common/connectionConfig';
/**
* ServerTreeview implements the dynamic tree view.
@@ -196,6 +197,11 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
this.deleteObjectExplorerNodeAndRefreshTree(connectionParams.connectionProfile).catch(errors.onUnexpectedError);
}
}));
this._register(this._configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration(CONNECTIONS_SORT_BY_CONFIG_KEY)) {
this.refreshTree().catch(err => errors.onUnexpectedError);
}
}));
if (this._objectExplorerService && this._objectExplorerService.onUpdateObjectExplorerNodes) {
this._register(this._objectExplorerService.onUpdateObjectExplorerNodes(args => {