@@ -26,6 +26,7 @@ import {
26
26
checkChangedOnServer ,
27
27
compileOnly ,
28
28
importLocalFilesToServerSideFolder ,
29
+ loadChanges ,
29
30
} from "./commands/compile" ;
30
31
import { deleteExplorerItems } from "./commands/delete" ;
31
32
import { exportAll , exportCurrentFile , exportExplorerItems , getCategory } from "./commands/export" ;
@@ -785,6 +786,25 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
785
786
vscode . commands . registerCommand ( "vscode-objectscript.compileWithFlags" , ( ) => importAndCompile ( true ) ) ,
786
787
vscode . commands . registerCommand ( "vscode-objectscript.compileAll" , ( ) => namespaceCompile ( false ) ) ,
787
788
vscode . commands . registerCommand ( "vscode-objectscript.compileAllWithFlags" , ( ) => namespaceCompile ( true ) ) ,
789
+ vscode . commands . registerCommand ( "vscode-objectscript.refreshLocalFile" , async ( _file , files ) => {
790
+ const file = currentFile ( ) ;
791
+ if ( ! file ) {
792
+ return ;
793
+ }
794
+
795
+ try {
796
+ await loadChanges ( [ file ] ) ;
797
+ } catch ( error ) {
798
+ let message = `Failed to overwrite file from server '${ file . fileName } '.` ;
799
+ if ( error && error . errorText && error . errorText !== "" ) {
800
+ outputChannel . appendLine ( "\n" + error . errorText ) ;
801
+ outputChannel . show ( true ) ;
802
+ message += " Check 'ObjectScript' output channel for details." ;
803
+ }
804
+ vscode . window . showErrorMessage ( message , "Dismiss" ) ;
805
+ return ;
806
+ }
807
+ } ) ,
788
808
vscode . commands . registerCommand ( "vscode-objectscript.compileFolder" , ( _file , files ) =>
789
809
Promise . all ( files . map ( ( file ) => importFileOrFolder ( file , false ) ) )
790
810
) ,
0 commit comments