Skip to content

Commit 6d65f1b

Browse files
committed
fix: Status label
1 parent 0496d3a commit 6d65f1b

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

‎src/components/lspInfoDialog/index.js‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,23 @@ function getActiveClients() {
2424
function getServerStatus(serverId) {
2525
const activeClients = getActiveClients();
2626
const client = activeClients.find((c) => c.server?.id === serverId);
27-
if (!client) return strings["lsp:stopped status"];
27+
if (!client) return "stopped";
2828
try {
29-
return client.client?.connected !== false
30-
? strings["lsp:active status"]
31-
: strings["lsp:connecting status"];
29+
return client.client?.connected !== false ? "active" : "connecting";
3230
} catch {
33-
return strings["lsp:stopped status"];
31+
return "stopped";
3432
}
3533
}
3634

35+
function getStatusLabel(status) {
36+
const map = {
37+
active: strings["lsp:active status"],
38+
connecting: strings["lsp:connecting status"],
39+
stopped: strings["lsp:stopped status"],
40+
};
41+
return map[status] || status;
42+
}
43+
3744
function getClientState(serverId) {
3845
const activeClients = getActiveClients();
3946
return activeClients.find((c) => c.server?.id === serverId) || null;
@@ -286,7 +293,7 @@ function showLspInfoDialog() {
286293
/>
287294
<div className="lsp-server-info">
288295
<span className="lsp-server-name">{server.label}</span>
289-
<span className="lsp-server-status">{status}</span>
296+
<span className="lsp-server-status">{getStatusLabel(status)}</span>
290297
</div>
291298
{errorCount > 0 && (
292299
<span className="lsp-error-badge">{errorCount}</span>

0 commit comments

Comments
 (0)