Skip to content

Commit 1078e01

Browse files
committed
various fixes
1 parent cfbadc4 commit 1078e01

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"viewsWelcome": [
7575
{
7676
"view": "explorer",
77-
"contents": "You can also create a new workspace that edits or views code directly on an [InterSystems server](https://intersystems-community.github.io/vscode-objectscript/serverside/).\n[Choose Server and Namespace](command:vscode-objectscript.addServerNamespaceToWorkspace)"
77+
"contents": "You can also create a new workspace to edit or view code directly on an [InterSystems server](https://intersystems-community.github.io/vscode-objectscript/serverside/).\n[Choose Server and Namespace](command:vscode-objectscript.addServerNamespaceToWorkspace)"
7878
}
7979
],
8080
"menus": {

src/commands/addServerNamespaceToWorkspace.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,26 @@ export async function addServerNamespaceToWorkspace(): Promise<void> {
1010
return;
1111
}
1212
// Get user's choice of server
13-
const options: vscode.QuickPickOptions = { ignoreFocusOut: true };
13+
const options: vscode.QuickPickOptions = {};
1414
const serverName: string = await serverManagerApi.pickServer(undefined, options);
1515
if (!serverName) {
1616
return;
1717
}
1818
// Get its namespace list
1919
let uri = vscode.Uri.parse(`isfs://${serverName}/?ns=%SYS`);
2020
const api = new AtelierAPI(uri);
21-
const allNamespaces: string[] = await api.serverInfo().then((data) => data.result.content.namespaces);
21+
const allNamespaces: string[] = await api
22+
.serverInfo()
23+
.then((data) => data.result.content.namespaces)
24+
.catch(() => []);
2225
// Prepare a displayable form of its connection spec as a hint to the user
2326
const connSpec = await serverManagerApi.getServerSpec(serverName);
2427
const connDisplayString = `${connSpec.webServer.scheme}://${connSpec.webServer.host}:${connSpec.webServer.port}/${connSpec.webServer.pathPrefix}`;
28+
// Handle serveInfo having failed or returned no namespaces
29+
if (!allNamespaces.length) {
30+
vscode.window.showErrorMessage(`No namespace list returned by server at ${connDisplayString}`);
31+
return;
32+
}
2533
// Get user's choice of namespace
2634
const namespace = await vscode.window.showQuickPick(allNamespaces, {
2735
placeHolder: `Namespace on server '${serverName}' (${connDisplayString})`,

src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const aiKey = packageJson.aiKey;
101101
export const config = (setting?: string, workspaceFolderName?: string): vscode.WorkspaceConfiguration | any => {
102102
workspaceFolderName = workspaceFolderName || currentWorkspaceFolder();
103103
if (
104-
vscode.workspace.workspaceFolders &&
104+
vscode.workspace.workspaceFolders?.length &&
105105
workspaceFolderName &&
106106
workspaceFolderName !== "" &&
107107
vscode.workspace.getConfiguration("intersystems.servers", null).has(workspaceFolderName)

0 commit comments

Comments
 (0)