Skip to content

Commit 07d5689

Browse files
Emit error codes when reporting diagnostics.
Addresses part of issue #506.
1 parent 16d1cfd commit 07d5689

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/compiler/tsc.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,18 @@ module ts {
8686
}
8787

8888
function reportDiagnostic(diagnostic: Diagnostic) {
89+
var output = "";
90+
8991
if (diagnostic.file) {
9092
var loc = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start);
91-
sys.write(diagnostic.file.filename + "(" + loc.line + "," + loc.character + "): " + diagnostic.messageText + sys.newLine);
92-
}
93-
else {
94-
sys.write(diagnostic.messageText + sys.newLine);
93+
94+
var output = diagnostic.file.filename + "(" + loc.line + "," + loc.character + "): ";
9595
}
96+
97+
var category = DiagnosticCategory[diagnostic.category];
98+
output += category + " TS" + diagnostic.code + ": " + diagnostic.messageText + sys.newLine;
99+
100+
sys.write(output);
96101
}
97102

98103
function reportDiagnostics(diagnostics: Diagnostic[]) {

0 commit comments

Comments
 (0)