Skip to content

Commit a999e5e

Browse files
committed
Changes after PR comments
1 parent 7526c0b commit a999e5e

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/extension.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
803803
continue;
804804
}
805805
}
806-
for await (const workspaceFolder of vscode.workspace.workspaceFolders) {
806+
for await (const workspaceFolder of vscode.workspace.workspaceFolders ?? []) {
807807
await addWsServerRootFolderData(workspaceFolder.uri);
808808
}
809809

@@ -1344,7 +1344,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
13441344
}
13451345
// Check connections sequentially for each workspace folder
13461346
let refreshFilesExplorer = false;
1347-
for await (const folder of vscode.workspace.workspaceFolders) {
1347+
for await (const folder of vscode.workspace.workspaceFolders ?? []) {
13481348
if (schemas.includes(folder.uri.scheme)) {
13491349
refreshFilesExplorer = true;
13501350
}

src/utils/index.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -633,12 +633,15 @@ export async function addWsServerRootFolderData(uri: vscode.Uri): Promise<void>
633633
const value: WSServerRootFolderData = {
634634
redirectDotvscode: true,
635635
};
636-
if (isCSPFile(uri)) {
637-
// A CSP-type root folder that already has a .vscode/settings.json file must not redirect .vscode/* references
636+
if (isCSPFile(uri) && !["", "/"].includes(uri.path)) {
637+
// A CSP-type root folder for a specific webapp that already has a .vscode/settings.json file must not redirect .vscode/* references
638638
const api = new AtelierAPI(uri);
639-
api.getDoc(`${uri.path}/.vscode/settings.json`).then(() => {
640-
value.redirectDotvscode = false;
641-
});
639+
api
640+
.headDoc(`${uri.path}/.vscode/settings.json`)
641+
.then(() => {
642+
value.redirectDotvscode = false;
643+
})
644+
.catch(() => {});
642645
}
643646
wsServerRootFolders.set(uri.toString(), value);
644647
}

0 commit comments

Comments
 (0)