Skip to content
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
10 changes: 7 additions & 3 deletions src/providers/FileSystemProvider/FileSystemProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,11 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
!uri.path.includes("/_vscode/") &&
vscode.workspace.getConfiguration("objectscript", uri).get("compileOnSave")
) {
this.compile(uri, entry, update);
// Need to return the compile promise because technically the post-save compilation
// is part of the "write" operation from VS Code's point of view. This is required
// to prevent concurreny issues when VS Code refreshs its internal representaton of
// the file system while documents are being compiled.
return this.compile(uri, entry, update);
} else if (update) {
// The file's contents may have changed as a result of the save,
// so make sure we notify VS Code and any watchers of the change
Expand Down Expand Up @@ -589,7 +593,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
// Force VS Code to refresh the file's contents in the editor UI
vscode.commands.executeCommand("workbench.action.files.revert");
}
}, 25);
}, 75);
}
}

Expand Down Expand Up @@ -875,7 +879,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
this._fireSoon(
...(
await api
.actionIndex(Array.from(new Set(...compileList.concat(filesToUpdate))))
.actionIndex(Array.from(new Set(compileList.concat(filesToUpdate))))
.then((data) => data.result.content.flatMap((idx) => (!idx.status.length ? idx.others : [])))
.catch(() => {
// Index API returned an error. This should never happen.
Expand Down