-
-
Notifications
You must be signed in to change notification settings - Fork 185
Return diagnostics instead of throwing errors #769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
680585e
Add diagnostic reporting and convert forbidden for...in array error
ark120202 6ecdec3
Include generated code in diagnostic snapshots
ark120202 a3a9732
Remove some errors that already have TypeScript diagnostics
ark120202 2763d0d
Replace unactionable errors with assertions
ark120202 4997d61
Replace empty json file diagnostic with runtime error
ark120202 f4673a8
Refactor `@forRange` annotation tests
ark120202 95471f3
Move invalid `@forRange` call error to diagnostics
ark120202 05f9f50
Make annotation errors diagnostics
ark120202 a08e239
Make unsupported `luaIterator` usage error a diagnostic
ark120202 0306f28
Make function assignment errors diagnostics
ark120202 8d9a91b
Replace UnsupportedKind errors with diagnostics or better types
ark120202 8aff305
Make `UnsupportedForTarget` error a diagnostic
ark120202 2b9c2a6
Make `UnsupportedProperty` error a diagnostic
ark120202 85df23f
Make loop errors diagnostics
ark120202 65562cb
Simplift `isValidLuaIdentifier` usage
ark120202 1cfec8e
Make `InvalidAmbientIdentifierName` error a diagnostic
ark120202 afb40a5
Remove `UndefinedScope`
ark120202 2b8303e
Make class transform safer, fixes #771
ark120202 dc45631
Make all other errors diagnostics
ark120202 11c3ee4
Make `bundle` tests check diagnostic snapshots
ark120202 d70666f
Remove remaining TranspileError handling code
ark120202 f0f5773
Merge remote-tracking branch 'upstream/master' into diagnostics
ark120202 9c3a235
Fix formatting
ark120202 42f2dca
Update `loops.spec.ts.snap`
ark120202 ef22253
Temporary loosen `for...of` initializer variable declaration check
ark120202 3434bce
Refactor SimpleOperator handling
ark120202 03e9aa3
Fix typo
ark120202 9e80934
Merge remote-tracking branch 'upstream/master' into diagnostics
ark120202 f2feeb4
Remove unused missing import
ark120202 54aa5c2
Remove `test.only` from `conditionals.spec.ts`
ark120202 9312a0c
Use inline snapshots for simple tests
ark120202 e6883bf
Revert "Use inline snapshots for simple tests"
ark120202 0969123
Merge remote-tracking branch 'upstream/master' into diagnostics
ark120202 ac40ce2
Merge remote-tracking branch 'upstream/master' into diagnostics
ark120202 be9bb93
Merge remote-tracking branch 'upstream/master' into diagnostics
ark120202 e23b1d6
Factorize transpilation diagnostics
ark120202 e533ed7
Improve some diagnostic code spans
ark120202 0473f45
Allow to specify expected diagnostic codes in matchers
ark120202 5ef5ff2
Add expected diagnostics to snapshot assertions
ark120202 e11d018
Add expected diagnostics to function assignability cast tests
ark120202 51574a8
Add expected diagnostics to bundle tests
ark120202 9eaa4ad
Add changelog entry
ark120202 75de99d
Merge branch 'master' into diagnostics
ark120202 9434b22
Refactor for initializer variable transformation
ark120202 22cc853
Merge remote-tracking branch 'upstream/master' into diagnostics
ark120202 7021186
Update tests
ark120202 3040f6e
Refactor diagnostc factories
ark120202 c19626a
Fix `luaTable` interface declaration tests
ark120202 58cb0a0
Make condition more readable
ark120202 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,9 @@ | ||
| import * as ts from "typescript"; | ||
|
|
||
| export const prepareDiagnosticForFormatting = (diagnostic: ts.Diagnostic) => | ||
| diagnostic.source === "typescript-to-lua" ? { ...diagnostic, code: "TL" as any } : diagnostic; | ||
|
|
||
| export function createDiagnosticReporter(pretty: boolean, system = ts.sys): ts.DiagnosticReporter { | ||
| const reporter = ts.createDiagnosticReporter(system, pretty); | ||
| return diagnostic => { | ||
| if (diagnostic.source === "typescript-to-lua") { | ||
| diagnostic = { ...diagnostic, code: ("TL" + diagnostic.code) as any }; | ||
| } | ||
|
|
||
| reporter(diagnostic); | ||
| }; | ||
| return diagnostic => reporter(prepareDiagnosticForFormatting(diagnostic)); | ||
| } | ||
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
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
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.