Incremental compilation in watch mode - #488
Merged
Perryvw merged 7 commits intoMar 21, 2019
Merged
Conversation
Perryvw
reviewed
Mar 19, 2019
Perryvw
left a comment
Member
There was a problem hiding this comment.
I still want to test this out (will probably be tomorrow), but looks good!
| // Graciously handle transpilation errors | ||
| console.error("Encountered error parsing file: " + exception.message); | ||
| console.error(`${sourceFile.fileName} (${1 + pos.line},${pos.character})\n${exception.stack}`); | ||
| return 1; |
Member
There was a problem hiding this comment.
Might be nice to make these constants or an enum.
Contributor
Author
There was a problem hiding this comment.
I agree, though we should probably discuss error codes and general error handling of tstl in a separate PR.
Perryvw
requested changes
Mar 21, 2019
Perryvw
left a comment
Member
There was a problem hiding this comment.
Noticed a dodgy cast that shouldn't be too hard to handle properly, otherwise seems to work fine!
| while (true) { | ||
| const currentFile = program.getSemanticDiagnosticsOfNextAffectedFile(); | ||
| if (!currentFile) { break; } | ||
| const fileStatus = transpiler.emitSourceFile(currentFile.affected as ts.SourceFile); |
Member
There was a problem hiding this comment.
currentFile has type ts.SourceFile | ts.Program, you should explicitly handle both cases using ts.isSourceFile(currentFile), and program.getSourceFiles() to transpile all sourceFiles in a program, in case one is returned.
Perryvw
approved these changes
Mar 21, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For large projects, this reduces compilation time dramatically in watch mode, as only files actually affected by recent changes are transpiled and emitted.
Update: Now also processes transpiler errors in watch mode.