Skip to content

Emit error codes when reporting diagnostics. #508

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 5 commits into from
Aug 22, 2014

Conversation

DanielRosenwasser
Copy link
Member

Addresses part of issue #506.

Before:

file.ts(1,6): ';' expected. 
file.ts(1,11): ';' expected.

After:

file.ts(1,6): error TS1005: ';' expected. 
file.ts(1,11): error TS1005: ';' expected.

else {
sys.write(diagnostic.messageText + sys.newLine);

var output = diagnostic.file.filename + "(" + loc.line + "," + loc.character + "): ";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+=

@mhegazy
Copy link
Contributor

mhegazy commented Aug 22, 2014

👍

}

var category = DiagnosticCategory[diagnostic.category];
output += category + " TS" + diagnostic.code + ": " + diagnostic.messageText + sys.newLine;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does 'category' need to be localized?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sheetalkamat
Copy link
Member

Please do not checkin this change without change to https://github.com/Microsoft/TypeScript/blob/printDiagnosticCodes/src/harness/harness.ts#L776

Also I would recommend making the changes to https://github.com/Microsoft/TypeScript/blob/printDiagnosticCodes/src/harness/harness.ts#L791 such that it calls minimalDiagnosticsToString here itself instead of from runners (eg: https://github.com/Microsoft/TypeScript/blob/printDiagnosticCodes/src/harness/rwcRunner.ts#L155 and https://github.com/Microsoft/TypeScript/blob/printDiagnosticCodes/src/harness/projectsRunner.ts#L302)
its important that compiler runner emit the error code so there is a way to verify error codes when someone add/modifies error codes.

@CyrusNajmabadi
Copy link
Contributor

👍

@DanielRosenwasser
Copy link
Member Author

@sheetalkamat I made the change to minimalDiagnosticsToString - I agree that we should make a general change to emit error codes; however, that seems like a change that will make this PR a bit difficult to digest.

@sheetalkamat
Copy link
Member

I would either do compilerrunner change as a separate iteration of this same pull request (I prefer that) or create a separate pull request for the same, But given that now we are showing error codes in error that change should be done sooner than later.

@DanielRosenwasser
Copy link
Member Author

Will do. I'll start working on it. Thanks!

DanielRosenwasser added a commit that referenced this pull request Aug 22, 2014
Emit error codes when reporting diagnostics.
@DanielRosenwasser DanielRosenwasser merged commit b73558d into master Aug 22, 2014
@DanielRosenwasser DanielRosenwasser deleted the printDiagnosticCodes branch August 22, 2014 23:21
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants