Skip to content

Commit

Permalink
fix(vscode): make error message when opening server menu more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
nedpals committed Mar 21, 2024
1 parent b22bee7 commit 3bcd08c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion vscode-bugbuddy/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ export async function disconnectServer() {
}

export function isServerConnected() {
if (currentConnectionStatus === ConnectionStatus.disabled) {
return false;
}

const client = getClient();
if (!client) {
return false;
Expand All @@ -231,12 +235,16 @@ interface ServerStats {
}

export async function showServerMenu() {
if (!isServerConnected()) {
throw new ClientError('Please open a folder first to be able to access BugBuddy.');
}

let stats: ServerStats | null = null;
const client = getClient();

try {
if (client.needsStart()) {
throw new ClientError('BugBuddy LSP client not initialized.');
throw new ClientError('BugBuddy server is not connected. Please connect to the server first.');
}

stats = await client.sendRequest<ServerStats>('$/status');
Expand Down

0 comments on commit 3bcd08c

Please sign in to comment.