From 3bcd08cad2d433ce595f0711caed3eb4bb96ac9c Mon Sep 17 00:00:00 2001 From: Ned Palacios Date: Thu, 21 Mar 2024 12:56:53 +0800 Subject: [PATCH] fix(vscode): make error message when opening server menu more clear --- vscode-bugbuddy/src/client.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/vscode-bugbuddy/src/client.ts b/vscode-bugbuddy/src/client.ts index 16b4591..ff57af6 100644 --- a/vscode-bugbuddy/src/client.ts +++ b/vscode-bugbuddy/src/client.ts @@ -210,6 +210,10 @@ export async function disconnectServer() { } export function isServerConnected() { + if (currentConnectionStatus === ConnectionStatus.disabled) { + return false; + } + const client = getClient(); if (!client) { return false; @@ -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('$/status');