Skip to content

Commit c44e408

Browse files
Merge pull request #437 from gjsjohnmurray/fix-436
fix #436 status bar panel behaviour when no connection defined
2 parents 5d5d04f + 3d7b96a commit c44e408

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/commands/serverActions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ export async function serverActions(): Promise<void> {
99
const { apiTarget, configName: workspaceFolder } = connectionTarget();
1010
const api = new AtelierAPI(apiTarget);
1111
const { active, host = "", ns = "", https, port = 0, username, password } = api.config;
12+
if (host === "") {
13+
return vscode.commands.executeCommand("workbench.view.extension.ObjectScriptView");
14+
}
1215
const { links } = config("conn");
1316
const nsEncoded = encodeURIComponent(ns);
1417
const actions: ServerAction[] = [];

src/extension.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,17 @@ export async function checkConnection(clearCookies = false, uri?: vscode.Uri): P
199199
}
200200
let api = new AtelierAPI(apiTarget, false);
201201
const { active, host = "", port = 0, username, ns = "" } = api.config;
202-
let connInfo = `${host}:${port}[${ns}]`;
203-
if (!host.length || !port || !ns.length) {
204-
connInfo = packageJson.displayName;
205-
}
206202
vscode.commands.executeCommand("setContext", "vscode-objectscript.connectActive", active);
203+
if (!host.length && !port && !ns.length) {
204+
panel.text = `${PANEL_LABEL}`;
205+
panel.tooltip = `No connection configured`;
206+
return;
207+
}
208+
let connInfo = `${host}:${port}[${ns}]`;
207209
if (!active) {
210+
if (!host.length || !port || !ns.length) {
211+
connInfo = `incompletely specified server ${connInfo}`;
212+
}
208213
panel.text = `${PANEL_LABEL} $(warning)`;
209214
panel.tooltip = `Connection to ${connInfo} is disabled`;
210215
return;

0 commit comments

Comments
 (0)