File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -71,11 +71,27 @@ export class Editor {
7171 "// END PREPEND" ,
7272 initialCode ,
7373 ] . join ( "\n" ) ;
74+ self . log ( contents )
7475
7576 await vscode . workspace . fs . readFile ( vscode . Uri . file ( filePath ) ) . then (
7677 ( value ) => {
7778 if ( value . toString ( ) !== contents ) {
78- console . log ( "editor code changed while offline" )
79+ self . log ( "EXTENSION: Conflict detected between local and remote, prompting user to choose one" )
80+ vscode . window
81+ . showInformationMessage (
82+ "The program on file differs from the one on the Source Academy servers." +
83+ "Which program should we use? (Note that picking one will overwrite the other)" ,
84+ "Local" , "Server" )
85+ . then ( async answer => {
86+ // By default the code displayed is the local one
87+ if ( answer === "Server" ) {
88+ await vscode . workspace . fs . writeFile (
89+ uri ,
90+ new TextEncoder ( ) . encode ( contents ) ,
91+ ) ;
92+ }
93+ } )
94+
7995 }
8096 } ,
8197 async ( ) => {
You can’t perform that action at this time.
0 commit comments