Skip to content

Commit b7884a6

Browse files
committed
Fix breakage v3.0 caused the InterSystems Testing Manager extension
1 parent d94629c commit b7884a6

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

src/utils/index.ts

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -605,25 +605,39 @@ export async function addWsServerRootFolderData(wsFolders: readonly vscode.Works
605605
if (!wsFolders?.length) return;
606606
return Promise.allSettled(
607607
wsFolders.map(async (wsFolder) => {
608-
if (notIsfs(wsFolder.uri)) return;
609608
const api = new AtelierAPI(wsFolder.uri);
610609
if (!api.active) return;
611610
const value: WSServerRootFolderData = {
612611
redirectDotvscode: true,
613612
canRedirectDotvscode: true,
614613
};
615-
if (isCSP(wsFolder.uri) && !["", "/"].includes(wsFolder.uri.path)) {
616-
// A CSP-type root folder for a specific webapp that already has a
617-
// .vscode/settings.json file must not redirect .vscode/* references
618-
await api
619-
.headDoc(`${wsFolder.uri.path}${!wsFolder.uri.path.endsWith("/") ? "/" : ""}.vscode/settings.json`)
620-
.then(() => {
621-
value.redirectDotvscode = false;
622-
})
623-
.catch(() => {});
614+
let folderKey: string;
615+
if (wsFolder.uri.scheme === "file") {
616+
// Special case where folder is local and has an active server connection.
617+
// Allow extensions such as InterSystems Testing Manager (intersystems-community.testingmanager)
618+
// to access the corresponding server-side .vscode subtree using an ISFS uri.
619+
folderKey = vscode.Uri.from({
620+
scheme: "isfs",
621+
authority: wsFolder.name,
622+
path: "/",
623+
query: `ns=${api.ns}`,
624+
}).toString();
625+
} else {
626+
if (notIsfs(wsFolder.uri)) return;
627+
folderKey = wsFolder.uri.toString();
628+
if (isCSP(wsFolder.uri) && !["", "/"].includes(wsFolder.uri.path)) {
629+
// A CSP-type isfs root folder for a specific webapp that already has a
630+
// .vscode/settings.json file must not redirect .vscode/* references
631+
await api
632+
.headDoc(`${wsFolder.uri.path}${!wsFolder.uri.path.endsWith("/") ? "/" : ""}.vscode/settings.json`)
633+
.then(() => {
634+
value.redirectDotvscode = false;
635+
})
636+
.catch(() => {});
637+
}
624638
}
625639
if (value.redirectDotvscode) {
626-
// We must redirect .vscode Uris for this folder, so see
640+
// We must redirect .vscode isfs Uris for this folder, so see
627641
// if the web app to do so is configured on the server
628642
const key = `${api.serverId}:%SYS`.toLowerCase();
629643
let webApps = cspApps.get(key);
@@ -636,7 +650,7 @@ export async function addWsServerRootFolderData(wsFolders: readonly vscode.Works
636650
}
637651
value.canRedirectDotvscode = webApps.includes("/_vscode");
638652
}
639-
wsServerRootFolders.set(wsFolder.uri.toString(), value);
653+
wsServerRootFolders.set(folderKey, value);
640654
})
641655
);
642656
}

0 commit comments

Comments
 (0)