Skip to content

Fix compile loop when one local workspace folder is a subfolder of another #1525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/utils/documentIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,17 +177,28 @@ export async function indexWorkspaceFolder(wsFolder: vscode.WorkspaceFolder): Pr
// part of the workspace folder, like "git" files
return;
}
if (vscode.workspace.getWorkspaceFolder(uri)?.uri.toString() != wsFolder.uri.toString()) {
// This file is not in this workspace folder. This can occur if there
// are two workspace folders open where one is a subfolder of the other
// and the file being changed is in the subfolder. This event will fire
// for both watchers, but VS Code will correctly report that the file
// is in the subfolder workspace folder, so the parent watcher can
// safely ignore the event.
return;
}
const uriString = uri.toString();
if (openCustomEditors.includes(uriString)) {
// This class is open in a graphical editor, so its name will not change
// and any updates to the class will be handled by that editor
touchedByVSCode.delete(uriString);
return;
}
if (exportedUris.has(uriString)) {
// This creation/change event was fired due to a server
// export, so don't re-sync the file with the server.
// The index has already been updated.
exportedUris.delete(uriString);
touchedByVSCode.delete(uriString);
return;
}
const api = new AtelierAPI(uri);
Expand Down Expand Up @@ -225,6 +236,15 @@ export async function indexWorkspaceFolder(wsFolder: vscode.WorkspaceFolder): Pr
// part of the workspace folder, like "git" files
return;
}
if (vscode.workspace.getWorkspaceFolder(uri)?.uri.toString() != wsFolder.uri.toString()) {
// This file is not in this workspace folder. This can occur if there
// are two workspace folders open where one is a subfolder of the other
// and the file being changed is in the subfolder. This event will fire
// for both watchers, but VS Code will correctly report that the file
// is in the subfolder workspace folder, so the parent watcher can
// safely ignore the event.
return;
}
const uriString = uri.toString();
const api = new AtelierAPI(uri);
const syncLocalChanges: string = vscode.workspace
Expand Down