Skip to content

Commit 76f57f0

Browse files
authored
fix(explorer): auto-open connection when done connecting, fix auto open on delete VSCODE-325 VSCODE-398 (#619)
1 parent 34b3f1f commit 76f57f0

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/explorer/explorerTreeController.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,12 @@ export default class ExplorerTreeController
173173
this._connectionTreeItems[connection.id] = new ConnectionTreeItem({
174174
connectionId: connection.id,
175175
collapsibleState: connectionExpandedState,
176-
isExpanded: isActiveConnection,
176+
// Set expanded when we're connecting to a connection so that it
177+
// expands when it's connected.
178+
isExpanded:
179+
isBeingConnectedTo ||
180+
connectionExpandedState ===
181+
vscode.TreeItemCollapsibleState.Expanded,
177182
connectionController: this._connectionController,
178183
cacheIsUpToDate: pastConnectionTreeItems[connection.id]
179184
? pastConnectionTreeItems[connection.id].cacheIsUpToDate

src/test/suite/explorer/explorerController.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,11 @@ suite('Explorer Controller Test Suite', function () {
152152
const connectionName =
153153
testConnectionController._connections[connectionId].name;
154154

155-
assert(
156-
connectionName === 'localhost:27088',
157-
`Expected active connection name to be 'localhost:27088' found ${connectionName}`
158-
);
155+
const connectionsItemsFirstConnect = await treeController.getChildren();
156+
157+
assert.strictEqual(connectionName, 'localhost:27088');
158+
// Ensure we auto expand when it's successfully connected to.
159+
assert(connectionsItemsFirstConnect[0].isExpanded);
159160

160161
try {
161162
await testConnectionController.addNewConnectionStringAndConnect(

0 commit comments

Comments
 (0)