@@ -2,6 +2,13 @@ import * as vscode from "vscode";
2
2
import { AtelierAPI } from "../api" ;
3
3
import { panel , resolveConnectionSpec } from "../extension" ;
4
4
5
+ enum AccessMode {
6
+ Code ,
7
+ WebappFiles ,
8
+ CodeReadonly ,
9
+ WebappFilesReadonly ,
10
+ }
11
+
5
12
export async function addServerNamespaceToWorkspace ( ) : Promise < void > {
6
13
const serverManagerApi = await getServerManagerApi ( ) ;
7
14
if ( ! serverManagerApi ) {
@@ -11,7 +18,7 @@ export async function addServerNamespaceToWorkspace(): Promise<void> {
11
18
return ;
12
19
}
13
20
// Get user's choice of server
14
- const options : vscode . QuickPickOptions = { } ;
21
+ const options : vscode . QuickPickOptions = { ignoreFocusOut : true } ;
15
22
const serverName : string = await serverManagerApi . pickServer ( undefined , options ) ;
16
23
if ( ! serverName ) {
17
24
return ;
@@ -49,25 +56,42 @@ export async function addServerNamespaceToWorkspace(): Promise<void> {
49
56
// Get user's choice of namespace
50
57
const namespace = await vscode . window . showQuickPick ( allNamespaces , {
51
58
placeHolder : `Namespace on server '${ serverName } ' (${ connDisplayString } )` ,
59
+ ignoreFocusOut : true ,
52
60
} ) ;
53
61
if ( ! namespace ) {
54
62
return ;
55
63
}
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 (
58
66
[
59
67
{
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." ,
63
86
} ,
64
- { value : false , label : "Read-only" , detail : "Documents opened from this folder will be read-only." } ,
65
87
] ,
66
- { placeHolder : "Choose the mode of access" }
88
+ { placeHolder : "Choose the type of access" , ignoreFocusOut : true }
67
89
) ;
68
90
// 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" : "" } ` } ) ;
71
95
// Append it to the workspace
72
96
const added = vscode . workspace . updateWorkspaceFolders (
73
97
vscode . workspace . workspaceFolders ? vscode . workspace . workspaceFolders . length : 0 ,
0 commit comments