File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ async function main() {
2222
2323async function downloadLsp ( ) {
2424 const outputFolder = getOutputDir ( ) ;
25- const version = "0.1.4 " ;
25+ const version = "0.1.8 " ;
2626 const lspFilename = "source-lsp.js" ;
2727 const url = `https://github.com/source-academy/source-lsp/releases/download/v${ version } /${ lspFilename } ` ;
2828 // const url = `https://github.com/source-academy/source-lsp/releases/latest/download/${lspFilename}`;
Original file line number Diff line number Diff line change @@ -73,7 +73,11 @@ export class Editor {
7373 ] . join ( "\n" ) ;
7474
7575 await vscode . workspace . fs . readFile ( vscode . Uri . file ( filePath ) ) . then (
76- ( ) => null ,
76+ ( value ) => {
77+ if ( value . toString ( ) !== contents ) {
78+ console . log ( "editor code changed while offline" )
79+ }
80+ } ,
7781 async ( ) => {
7882 self . log ( `Opening file failed, creating at ${ filePath } ` ) ;
7983 await vscode . workspace . fs . writeFile (
@@ -94,12 +98,12 @@ export class Editor {
9498 vscode . commands . executeCommand ( "editor.fold" ) ;
9599
96100 self . editor = editor ;
97- vscode . workspace . onDidChangeTextDocument ( ( ) => {
101+ vscode . workspace . onDidChangeTextDocument ( ( e : vscode . TextDocumentChangeEvent ) => {
98102 if ( ! self . onChangeCallback ) {
99103 return ;
100104 }
101105 const text = editor . document . getText ( ) ;
102- if ( self . code === text ) {
106+ if ( e . contentChanges . length === 0 ) {
103107 self . log ( `EXTENSION: Editor's code did not change, ignoring` ) ;
104108 return ;
105109 }
@@ -109,7 +113,7 @@ export class Editor {
109113 ) ;
110114 return ;
111115 }
112- self . log ( `EXTENSION: Editor's code changed! ${ text } ` ) ;
116+ self . log ( `EXTENSION: Editor's code changed!` ) ;
113117 self . onChangeCallback ( self ) ;
114118 self . code = text ;
115119 } ) ;
You can’t perform that action at this time.
0 commit comments