@@ -561,7 +561,11 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
561561          ! uri . path . includes ( "/_vscode/" )  && 
562562          vscode . workspace . getConfiguration ( "objectscript" ,  uri ) . get ( "compileOnSave" ) 
563563        )  { 
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 ) ; 
565569        }  else  if  ( update )  { 
566570          // The file's contents may have changed as a result of the save, 
567571          // so make sure we notify VS Code and any watchers of the change 
@@ -589,7 +593,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
589593          // Force VS Code to refresh the file's contents in the editor UI 
590594          vscode . commands . executeCommand ( "workbench.action.files.revert" ) ; 
591595        } 
592-       } ,  25 ) ; 
596+       } ,  75 ) ; 
593597    } 
594598  } 
595599
@@ -875,7 +879,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
875879    this . _fireSoon ( 
876880      ...( 
877881        await  api 
878-           . actionIndex ( Array . from ( new  Set ( ... compileList . concat ( filesToUpdate ) ) ) ) 
882+           . actionIndex ( Array . from ( new  Set ( compileList . concat ( filesToUpdate ) ) ) ) 
879883          . then ( ( data )  =>  data . result . content . flatMap ( ( idx )  =>  ( ! idx . status . length  ? idx . others  : [ ] ) ) ) 
880884          . catch ( ( )  =>  { 
881885            // Index API returned an error. This should never happen. 
0 commit comments