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
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.
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