Skip to content

Commit 487f7bd

Browse files
authored
Remove flat and type isfs query parameters (intersystems-community#1208)
1 parent 6f52f7c commit 487f7bd

File tree

4 files changed

+21
-77
lines changed

4 files changed

+21
-77
lines changed

src/extension.ts

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

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

src/providers/DocumentContentProvider.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,12 @@ export class DocumentContentProvider implements vscode.TextDocumentContentProvid
8080
if (authorityParts.length === 2 && namespace?.toLowerCase() === authorityParts[1]) {
8181
namespace = "";
8282
}
83-
const flat = new URLSearchParams(wFolderUri.query).get("flat") == "1";
8483
const fileExt = name.split(".").pop();
8584
const fileName = name
8685
.split(".")
8786
.slice(0, -1)
88-
.join(/cls|mac|int|inc/i.test(fileExt) && !flat ? "/" : ".");
89-
if (/.\.G?[1-9]\.int$/i.test(name) && !flat) {
87+
.join(/cls|mac|int|inc/i.test(fileExt) ? "/" : ".");
88+
if (/.\.G?[1-9]\.int$/i.test(name)) {
9089
// This is a generated INT file
9190
name =
9291
fileName.slice(0, fileName.lastIndexOf("/")) +

src/providers/FileSystemProvider/TextSearchProvider.ts

Lines changed: 18 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -377,31 +377,28 @@ export class TextSearchProvider implements vscode.TextSearchProvider {
377377
max: options.maxResults ?? 100000,
378378
};
379379

380-
// Generate the include and exclude filters, except for if 'flat' is present
381-
// because there isn't an easy way to convert all dots to slashes except for file extensions.
380+
// Generate the include and exclude filters.
382381
// The matching is case sensitive and file names are normalized so that the first character
383382
// and path separator are '/' (for example, '/%Api/Atelier/v6.cls' and '/csp/user/menu.csp').
384-
if (params.has("flat") && params.get("flat").length ? params.get("flat") != "1" : true) {
385-
let includesArr = options.includes;
386-
let excludesArr = removeConfigExcludes(options.folder, options.excludes);
387-
if (!["", "/"].includes(options.folder.path)) {
388-
// Prepend path with a trailing slash
389-
const prefix = !options.folder.path.endsWith("/") ? `${options.folder.path}/` : options.folder.path;
390-
includesArr = includesArr.map((e) => `${prefix}${e}`);
391-
excludesArr = excludesArr.map((e) => `${prefix}${e}`);
392-
}
383+
let includesArr = options.includes;
384+
let excludesArr = removeConfigExcludes(options.folder, options.excludes);
385+
if (!["", "/"].includes(options.folder.path)) {
386+
// Prepend path with a trailing slash
387+
const prefix = !options.folder.path.endsWith("/") ? `${options.folder.path}/` : options.folder.path;
388+
includesArr = includesArr.map((e) => `${prefix}${e}`);
389+
excludesArr = excludesArr.map((e) => `${prefix}${e}`);
390+
}
393391

394-
// Add leading slash if we don't start with **/
395-
includesArr = includesArr.map((e) => (!e.startsWith("**/") ? `/${e}` : e));
396-
excludesArr = excludesArr.map((e) => (!e.startsWith("**/") ? `/${e}` : e));
392+
// Add leading slash if we don't start with **/
393+
includesArr = includesArr.map((e) => (!e.startsWith("**/") ? `/${e}` : e));
394+
excludesArr = excludesArr.map((e) => (!e.startsWith("**/") ? `/${e}` : e));
397395

398-
// Convert the array of glob patterns into a single regular expression
399-
if (includesArr.length) {
400-
request.include = includesArr.map((e) => makeRe(e).source).join("|");
401-
}
402-
if (excludesArr.length) {
403-
request.exclude = excludesArr.map((e) => makeRe(e).source).join("|");
404-
}
396+
// Convert the array of glob patterns into a single regular expression
397+
if (includesArr.length) {
398+
request.include = includesArr.map((e) => makeRe(e).source).join("|");
399+
}
400+
if (excludesArr.length) {
401+
request.exclude = excludesArr.map((e) => makeRe(e).source).join("|");
405402
}
406403

407404
// Send the queue request
@@ -596,30 +593,6 @@ export class TextSearchProvider implements vscode.TextSearchProvider {
596593
}
597594
}
598595

599-
// Don't report matches in filetypes we don't want or don't handle
600-
const fileType = file.doc.split(".").pop().toLowerCase();
601-
if (!csp) {
602-
switch (params.get("type")) {
603-
case "cls":
604-
if (fileType !== "cls") {
605-
return;
606-
}
607-
break;
608-
609-
case "rtn":
610-
if (!["inc", "int", "mac"].includes(fileType)) {
611-
return;
612-
}
613-
break;
614-
615-
default:
616-
if (!["cls", "inc", "int", "mac"].includes(fileType)) {
617-
return;
618-
}
619-
break;
620-
}
621-
}
622-
623596
return reportMatchesForFile(file);
624597
})
625598
)

src/utils/FileProviderUtil.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ export async function projectContentsFromUri(uri: vscode.Uri, overrideFlat?: boo
9999
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 = params.has("type") && params.get("type").length ? params.get("type") : csp ? "csp" : "all";
103102

104103
const folder = !csp
105104
? uri.path.replace(/\//g, ".")
@@ -122,10 +121,6 @@ export function fileSpecFromURI(uri: vscode.Uri): string {
122121
} // otherwise, reference the type to get the desired files.
123122
else if (csp) {
124123
specOpts = folder.length > 1 ? "*" : "*.cspall";
125-
} else if (type === "rtn") {
126-
specOpts = "*.inc,*.mac,*.int";
127-
} else if (type === "cls") {
128-
specOpts = "*.cls";
129124
} else {
130125
specOpts = "*.cls,*.inc,*.mac,*.int";
131126
}
@@ -142,18 +137,14 @@ export function studioOpenDialogFromURI(
142137
}
143138
const sql = `SELECT Name, Type FROM %Library.RoutineMgr_StudioOpenDialog(?,?,?,?,?,?,?,?,?,?)`;
144139
const params = new URLSearchParams(uri.query);
145-
const csp = params.has("csp") && ["", "1"].includes(params.get("csp"));
146140
const spec = fileSpecFromURI(uri);
147141
const notStudio = "0";
148142
const dir = "1";
149143
const orderBy = "1";
150144
const generated = params.has("generated") && params.get("generated").length ? params.get("generated") : "0";
151145
const system =
152146
params.has("system") && params.get("system").length ? params.get("system") : api.ns === "%SYS" ? "1" : "0";
153-
let flat = !csp && params.has("flat") && params.get("flat").length ? params.get("flat") : "0";
154-
if (overrides && overrides.flat) {
155-
flat = "1";
156-
}
147+
const flat = overrides && overrides.flat ? "1" : "0";
157148
const mapped = params.has("mapped") && params.get("mapped") == "0" ? "0" : "1";
158149
return api.actionQuery(sql, [spec, dir, orderBy, system, flat, notStudio, generated, overrides.filter, "0", mapped]);
159150
}

0 commit comments

Comments
 (0)