Skip to content

Commit 1b9418a

Browse files
authored
Fix opening server-side generated INT routines (intersystems-community#1668)
1 parent 7db6cac commit 1b9418a

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/providers/FileSystemProvider/FileSystemProvider.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -243,18 +243,17 @@ export function isfsDocumentName(uri: vscode.Uri, csp?: boolean, pkg = false): s
243243
* error when `uri`'s path is not in "canonical form".
244244
*/
245245
function validateUriIsCanonical(uri: vscode.Uri): void {
246+
const numDots = uri.path.split(".").length - 1;
247+
const lastFour = uri.path.slice(-4);
246248
if (
247249
!isfsConfig(uri).csp &&
248-
[".cls", ".mac", ".int", ".inc"].includes(uri.path.slice(-4).toLowerCase()) &&
249-
// dotted packages
250-
(uri.path.split(".").length > 2 ||
251-
// extension has wrong case
252-
![".cls", ".mac", ".int", ".inc"].includes(uri.path.slice(-4)) ||
250+
[".cls", ".mac", ".int", ".inc"].includes(lastFour.toLowerCase()) &&
251+
// extension has wrong case
252+
(![".cls", ".mac", ".int", ".inc"].includes(lastFour) ||
253253
// short alias for %Library class
254-
(uri.path.startsWith("/%") &&
255-
uri.path.slice(-4) == ".cls" &&
256-
uri.path.split(".").length == 2 &&
257-
uri.path.split("/").length == 2))
254+
(uri.path.startsWith("/%") && lastFour == ".cls" && numDots == 1 && uri.path.split("/").length == 2) ||
255+
// dotted packages
256+
(numDots > 1 && !(numDots == 2 && /\.G?\d\.int$/.test(uri.path))))
258257
) {
259258
throw vscode.FileSystemError.FileNotFound(uri);
260259
}

0 commit comments

Comments
 (0)