haoranpb / futhark-language-server

Moved to Futhark.LSP
https://github.com/diku-dk/futhark/tree/master/src/Futhark/LSP
1 stars 0 forks source link

PositionMapping when use stale compile result #1

Open haoranpb opened 2 years ago

haoranpb commented 2 years ago

If one new line is inserted at the beginning of the file, everything would be messed up, need to figure out a way to convert source locations in the current version of a document back into the version of the document for which the rule was last computed successfully

https://github.com/haoranpb/futhark-language-server/blob/e8c0cb271a6445459d454b0169b09b949a2f8a59/src/Compile.hs#L34

athas commented 2 years ago

If you also store the full contents of the file/buffer at the last time the program managed to type-check, you can compute a diff that maps old source locations to new source locations.