diff --git a/src/controllers/ConnectionController.ts b/src/controllers/ConnectionController.ts index 35a292c7..2cf7eb4f 100644 --- a/src/controllers/ConnectionController.ts +++ b/src/controllers/ConnectionController.ts @@ -1,6 +1,5 @@ import * as vscode from 'vscode'; import type { - ConnectionPickItem, ConsoleType, Disposable, IConfigService, @@ -270,24 +269,21 @@ export class ConnectionController implements Disposable { editor.document.uri )?.serverUrl; - let result: - | ConnectionPickItem<'server', ServerState> - | ConnectionPickItem<'connection', IDhService> - | null = null; + let selectedCnResult: ServerState | IDhService | null = null; try { - result = await createConnectionQuickPick( + selectedCnResult = await createConnectionQuickPick( runningServersWithoutConnections, connections, editor.document.languageId, editorActiveConnectionUrl ); - if (result == null) { + if (selectedCnResult == null) { return false; } - await this.connectEditor(result.data, editor); + await this.connectEditor(selectedCnResult, editor); return true; } catch (err) { diff --git a/src/util/uiUtils.ts b/src/util/uiUtils.ts index 4c067189..92ae708f 100644 --- a/src/util/uiUtils.ts +++ b/src/util/uiUtils.ts @@ -38,11 +38,7 @@ export async function createConnectionQuickPick( connections: IDhService[], editorLanguageId: string, editorActiveConnectionUrl?: URL | null -): Promise< - | ConnectionPickItem<'server', ServerState> - | ConnectionPickItem<'connection', IDhService> - | null -> { +): Promise { const serverOptions: ConnectionPickItem<'server', ServerState>[] = servers.map(data => ({ type: 'server', @@ -95,7 +91,7 @@ export async function createConnectionQuickPick( return null; } - return result; + return result.data; } /**