Skip to content

Commit febbdc4

Browse files
Merge pull request #390 from gjsjohnmurray/fix-389
fix #389 Support adding of webapp-type workspace folders
2 parents 5cb0ed0 + 3bcba2f commit febbdc4

File tree

1 file changed

+34
-10
lines changed

1 file changed

+34
-10
lines changed

src/commands/addServerNamespaceToWorkspace.ts

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ import * as vscode from "vscode";
22
import { AtelierAPI } from "../api";
33
import { panel, resolveConnectionSpec } from "../extension";
44

5+
enum AccessMode {
6+
Code,
7+
WebappFiles,
8+
CodeReadonly,
9+
WebappFilesReadonly,
10+
}
11+
512
export async function addServerNamespaceToWorkspace(): Promise<void> {
613
const serverManagerApi = await getServerManagerApi();
714
if (!serverManagerApi) {
@@ -11,7 +18,7 @@ export async function addServerNamespaceToWorkspace(): Promise<void> {
1118
return;
1219
}
1320
// Get user's choice of server
14-
const options: vscode.QuickPickOptions = {};
21+
const options: vscode.QuickPickOptions = { ignoreFocusOut: true };
1522
const serverName: string = await serverManagerApi.pickServer(undefined, options);
1623
if (!serverName) {
1724
return;
@@ -49,25 +56,42 @@ export async function addServerNamespaceToWorkspace(): Promise<void> {
4956
// Get user's choice of namespace
5057
const namespace = await vscode.window.showQuickPick(allNamespaces, {
5158
placeHolder: `Namespace on server '${serverName}' (${connDisplayString})`,
59+
ignoreFocusOut: true,
5260
});
5361
if (!namespace) {
5462
return;
5563
}
56-
// Pick between isfs and isfs-readonly
57-
const editable = await vscode.window.showQuickPick(
64+
// Pick between isfs and isfs-readonly, code and web files
65+
const mode = await vscode.window.showQuickPick(
5866
[
5967
{
60-
value: true,
61-
label: "Editable",
62-
detail: "Documents opened from this folder will be editable directly on the server.",
68+
value: AccessMode.Code,
69+
label: `Edit Code in ${namespace}`,
70+
detail: "Edit classes, routines and other code assets.",
71+
},
72+
{
73+
value: AccessMode.WebappFiles,
74+
label: `Edit Web Application Files for ${namespace}`,
75+
detail: "Edit files belonging to web applications that use the namespace.",
76+
},
77+
{
78+
value: AccessMode.CodeReadonly,
79+
label: `View Code in ${namespace}`,
80+
detail: "Documents opened from this folder will be read-only.",
81+
},
82+
{
83+
value: AccessMode.WebappFilesReadonly,
84+
label: `View Web Application Files for ${namespace}`,
85+
detail: "Documents opened from this folder will be read-only.",
6386
},
64-
{ value: false, label: "Read-only", detail: "Documents opened from this folder will be read-only." },
6587
],
66-
{ placeHolder: "Choose the mode of access" }
88+
{ placeHolder: "Choose the type of access", ignoreFocusOut: true }
6789
);
6890
// Prepare the folder parameters
69-
const label = editable.value ? `${serverName}:${namespace}` : `${serverName}:${namespace} (read-only)`;
70-
uri = uri.with({ scheme: editable.value ? "isfs" : "isfs-readonly", query: `ns=${namespace}` });
91+
const editable = mode.value === AccessMode.Code || mode.value === AccessMode.WebappFiles;
92+
const webapp = mode.value === AccessMode.WebappFiles || mode.value === AccessMode.WebappFilesReadonly;
93+
const label = `${serverName}:${namespace}${webapp ? " web files" : ""}${!editable ? " (read-only)" : ""}`;
94+
uri = uri.with({ scheme: editable ? "isfs" : "isfs-readonly", query: `ns=${namespace}${webapp ? "&csp" : ""}` });
7195
// Append it to the workspace
7296
const added = vscode.workspace.updateWorkspaceFolders(
7397
vscode.workspace.workspaceFolders ? vscode.workspace.workspaceFolders.length : 0,

0 commit comments

Comments
 (0)