Task (REQUIRED):
Some code transpilers, like extension-teal, can skip over already transpiled files if it determines they do not need to be re-transpiled. In the case of extension-teal, the timestamp of the source file is compared against the timestamp of the existing output file. The file will be re-transpiled only if the source file is newer than the output file. This, however, does not work in the following situation:
User edits a .tl file and builds the project. The unsaved edits mark the file as dirty, prompting the editor to copy the in-memory state of all the .tl files in the project into a temporary directory that it then runs the transpiler on.
User undoes their edits and builds the project again. Since the undo brought the project back to a non-dirty state, the editor decides it can use the project directory itself as the input to the transpiler. However, the timestamp of the unedited source file on disk is now earlier than the timestamp of the transpiled output file, so extension-teal skips it and yields the previous output which contained the undone edits.
It is likely other transpilers will use a similar strategy to determine if a file needs to be re-transpiled, so we want to address this issue in the editor code.
One way to solve this would be to always copy the relevant source files into a persistent directory, and not bother with the project directory at all. If we instead focus on not overwriting the source files unless their contents differ from the previous build, their timestamps would be in line with what the transpiler can use to determine if they need to be re-transpiled or not.
Expected outcome (REQUIRED):
Transpilers such as extension-teal can run quicker since they can re-use the output from the previous build. We would also save time on the copying step when preparing the source directory for the transpiler.
Task (REQUIRED): Some code transpilers, like
extension-teal
, can skip over already transpiled files if it determines they do not need to be re-transpiled. In the case ofextension-teal
, the timestamp of the source file is compared against the timestamp of the existing output file. The file will be re-transpiled only if the source file is newer than the output file. This, however, does not work in the following situation:.tl
file and builds the project. The unsaved edits mark the file as dirty, prompting the editor to copy the in-memory state of all the.tl
files in the project into a temporary directory that it then runs the transpiler on.extension-teal
skips it and yields the previous output which contained the undone edits.It is likely other transpilers will use a similar strategy to determine if a file needs to be re-transpiled, so we want to address this issue in the editor code.
One way to solve this would be to always copy the relevant source files into a persistent directory, and not bother with the project directory at all. If we instead focus on not overwriting the source files unless their contents differ from the previous build, their timestamps would be in line with what the transpiler can use to determine if they need to be re-transpiled or not.
Expected outcome (REQUIRED): Transpilers such as
extension-teal
can run quicker since they can re-use the output from the previous build. We would also save time on the copying step when preparing the source directory for the transpiler.