@@ -561,7 +561,11 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
561
561
! uri . path . includes ( "/_vscode/" ) &&
562
562
vscode . workspace . getConfiguration ( "objectscript" , uri ) . get ( "compileOnSave" )
563
563
) {
564
- this . compile ( uri , entry , update ) ;
564
+ // Need to return the compile promise because technically the post-save compilation
565
+ // is part of the "write" operation from VS Code's point of view. This is required
566
+ // to prevent concurreny issues when VS Code refreshs its internal representaton of
567
+ // the file system while documents are being compiled.
568
+ return this . compile ( uri , entry , update ) ;
565
569
} else if ( update ) {
566
570
// The file's contents may have changed as a result of the save,
567
571
// so make sure we notify VS Code and any watchers of the change
@@ -589,7 +593,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
589
593
// Force VS Code to refresh the file's contents in the editor UI
590
594
vscode . commands . executeCommand ( "workbench.action.files.revert" ) ;
591
595
}
592
- } , 25 ) ;
596
+ } , 75 ) ;
593
597
}
594
598
}
595
599
@@ -875,7 +879,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
875
879
this . _fireSoon (
876
880
...(
877
881
await api
878
- . actionIndex ( Array . from ( new Set ( ... compileList . concat ( filesToUpdate ) ) ) )
882
+ . actionIndex ( Array . from ( new Set ( compileList . concat ( filesToUpdate ) ) ) )
879
883
. then ( ( data ) => data . result . content . flatMap ( ( idx ) => ( ! idx . status . length ? idx . others : [ ] ) ) )
880
884
. catch ( ( ) => {
881
885
// Index API returned an error. This should never happen.
0 commit comments