diff --git a/vscode-bugbuddy/src/client.ts b/vscode-bugbuddy/src/client.ts index f3bb84e..5e86c58 100644 --- a/vscode-bugbuddy/src/client.ts +++ b/vscode-bugbuddy/src/client.ts @@ -87,13 +87,8 @@ export async function startServer() { await client.start(); // get participant id - try { - // eslint-disable-next-line @typescript-eslint/naming-convention - const got = await client.sendRequest<{ participant_id: string }>('$/participantId'); - setConnectionStatus(ConnectionStatus.connected, { participantId: got.participant_id }); - } catch (e) { - setConnectionStatus(ConnectionStatus.connected, { participantId: 'unknown' }); - } + const participantId = await getParticipantId(); + setConnectionStatus(ConnectionStatus.connected, { participantId }); } catch (e) { setConnectionStatus(ConnectionStatus.failed); window.showErrorMessage(`Failed to connect: ${e}`); @@ -231,6 +226,15 @@ export async function showServerMenu() { } } +export async function getParticipantId() { + try { + const got = await client.sendRequest<{ participant_id: string }>('$/participantId'); + return got.participant_id; + } catch (e) { + return 'unknown'; + } +} + export async function generateParticipantId() { const resp = await window.showInformationMessage('Are you sure you want to generate a new participant ID?', 'Yes', 'No');