Skip to content

Commit 978dcff

Browse files
authored
Deprecate flat and type isfs query parameters (intersystems-community#1165)
1 parent f603d91 commit 978dcff

File tree

5 files changed

+29
-26
lines changed

5 files changed

+29
-26
lines changed

docs/ServerSide.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ Next create a workspace for editing code directly on the server:
3636
![Choose files.](../assets/images/ss-files.png "choose files")
3737
- If you chose to show web application files, pick an optional web application to show files from:
3838

39-
![Choose files.](../assets/images/ss-pick-webapp.png "choose files")
39+
![Choose web app.](../assets/images/ss-pick-webapp.png "choose web app")
4040
- If you chose to show a project's contents, pick the project:
4141

42-
![Choose files.](../assets/images/ss-pick-project.png "choose files")
42+
![Choose project.](../assets/images/ss-pick-project.png "choose project")
4343
- If you create your own filter, pick the filter options:
4444

45-
![Choose query parameters.](../assets/images/ss-query-params.png "choose query parameters")
45+
![Choose filter options.](../assets/images/ss-query-params.png "choose filter options")
4646
1. If you want to reopen this workspace in the future, use the command **File > Save Workspace As...** to save it as a `.code-workspace` file.
4747

4848
Note that the ObjectScript Explorer view is not visible in the ObjectScript view container. Because the files listed in the Explorer view are all on the server, the ObjectScript Explorer is not needed for this configuration.
@@ -147,15 +147,12 @@ Changes you make to files opened from this root folder of your VS Code workspace
147147

148148
The query string of the `uri` property accepts several parameters that control filtering and display of the server-side entities. The examples below access the USER namespace on the server whose definition is named 'myserver'.
149149

150-
- `isfs://myserver:user/?type=cls`, shows only classes
151-
- `isfs://myserver:user/?type=rtn`, shows only mac, int and inc files
152150
- `isfs://myserver:user/?generated=1`, shows generated files as well as not generated
153-
- `isfs://myserver:user/?filter=%Z*.mac,%z*.mac`, comma-delimited list of search options, ignores `type`. The default is `*.cls,*.inc,*.mac,*.int`. To see all files, use `*`.
154-
- `isfs://myserver:user/?flat=1`, a flat list of files. Does not split packages as folders. Cannot be combined with `csp`.
151+
- `isfs://myserver:user/?filter=%Z*.mac,%z*.mac`, comma-delimited list of search options. The default is `*.cls,*.inc,*.mac,*.int`. To see all files, use `*`.
155152
- `isfs://myserver:user/?project=prjname`, shows only files in project `prjname`. Cannot be combined with any other parameter.
156153
- `isfs://myserver:user/?mapped=0`, hides files that are mapped from a non-default database
157154

158-
The options `flat`, `generated` and `mapped` can be combined with each other, and with `type` or `filter`. If `filter` is specified, `type` is ignored.
155+
The options `generated` and `mapped` can be combined with each other, and with `filter`.
159156

160157
To modify the query parameters or name of an existing workspace folder, run the `Modify Server-Side Workspace Folder...` command from the command palette or the file explorer context menu.
161158

-15.7 KB
Loading

src/commands/addServerNamespaceToWorkspace.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,6 @@ async function modifyWsFolderUri(uri: vscode.Uri): Promise<vscode.Uri | undefine
284284
picked: params.has("filter"),
285285
value: "filter",
286286
},
287-
{
288-
label: "$(list-flat) Flat Files",
289-
detail: "Show a flat list of files. Do not treat packages as folders.",
290-
picked: params.has("flat"),
291-
value: "flat",
292-
},
293287
{
294288
label: "$(server-process) Show Generated",
295289
detail: "Also show files tagged as generated, e.g. by compilation.",
@@ -328,6 +322,7 @@ async function modifyWsFolderUri(uri: vscode.Uri): Promise<vscode.Uri | undefine
328322
params.delete("generated");
329323
params.delete("mapped");
330324
params.delete("system");
325+
params.delete("type");
331326
for (const otherParam of otherParams) {
332327
switch (otherParam.value) {
333328
case "filter": {
@@ -345,7 +340,6 @@ async function modifyWsFolderUri(uri: vscode.Uri): Promise<vscode.Uri | undefine
345340
}
346341
break;
347342
}
348-
case "flat":
349343
case "generated":
350344
case "system":
351345
params.set(otherParam.value, "1");

src/extension.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,6 +1333,25 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
13331333
);
13341334
reporter && reporter.sendTelemetryEvent("extensionActivated");
13351335

1336+
// Report the use of deprecated query parameters
1337+
(vscode.workspace.workspaceFolders || []).forEach(async (wf) => {
1338+
if (filesystemSchemas.includes(wf.uri.scheme)) {
1339+
const params = new URLSearchParams(wf.uri.query);
1340+
if (params.has("flat") || params.has("type")) {
1341+
const qp = params.has("flat") ? "flat" : "type";
1342+
await vscode.window
1343+
.showWarningMessage(
1344+
`Workspace folder '${wf.name}' is using deprecated query parameter '${qp}'. Modify it now?`,
1345+
"Yes",
1346+
"No"
1347+
)
1348+
.then(
1349+
(answer) => answer == "Yes" && vscode.commands.executeCommand("vscode-objectscript.modifyWsFolder", wf.uri)
1350+
);
1351+
}
1352+
}
1353+
});
1354+
13361355
// The API we export
13371356
const extensionApi = {
13381357
serverForUri(uri: vscode.Uri): any {

src/utils/FileProviderUtil.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,10 @@ export async function projectContentsFromUri(uri: vscode.Uri, overrideFlat?: boo
9696
return api.actionQuery(query, parameters).then((data) => data.result.content);
9797
}
9898

99-
export function fileSpecFromURI(uri: vscode.Uri, overrideType?: string): string {
99+
export function fileSpecFromURI(uri: vscode.Uri): string {
100100
const params = new URLSearchParams(uri.query);
101101
const csp = params.has("csp") && ["", "1"].includes(params.get("csp"));
102-
const type =
103-
overrideType && overrideType != ""
104-
? overrideType
105-
: params.has("type") && params.get("type").length
106-
? params.get("type")
107-
: csp
108-
? "csp"
109-
: "all";
102+
const type = params.has("type") && params.get("type").length ? params.get("type") : csp ? "csp" : "all";
110103

111104
const folder = !csp
112105
? uri.path.replace(/\//g, ".")
@@ -141,7 +134,7 @@ export function fileSpecFromURI(uri: vscode.Uri, overrideType?: string): string
141134

142135
export function studioOpenDialogFromURI(
143136
uri: vscode.Uri,
144-
overrides: { flat?: boolean; filter?: string; type?: string } = { flat: false, filter: "", type: "" }
137+
overrides: { flat?: boolean; filter?: string } = { flat: false, filter: "" }
145138
): Promise<any> {
146139
const api = new AtelierAPI(uri);
147140
if (!api.active) {
@@ -150,7 +143,7 @@ export function studioOpenDialogFromURI(
150143
const sql = `SELECT Name, Type FROM %Library.RoutineMgr_StudioOpenDialog(?,?,?,?,?,?,?,?,?,?)`;
151144
const params = new URLSearchParams(uri.query);
152145
const csp = params.has("csp") && ["", "1"].includes(params.get("csp"));
153-
const spec = fileSpecFromURI(uri, overrides.type);
146+
const spec = fileSpecFromURI(uri);
154147
const notStudio = "0";
155148
const dir = "1";
156149
const orderBy = "1";

0 commit comments

Comments
 (0)