Skip to content

Commit f78e0d0

Browse files
committed
Show custom diagnostics as TSTL<code> in CLI
1 parent f0e82ce commit f78e0d0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/tstl.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ import * as CommandLineParser from "./CommandLineParser";
66
import * as cliDiagnostics from "./diagnostics";
77

88
function createDiagnosticReporter(pretty: boolean): ts.DiagnosticReporter {
9-
return (ts as any).createDiagnosticReporter(ts.sys, pretty);
9+
const reporter: ts.DiagnosticReporter = (ts as any).createDiagnosticReporter(ts.sys, pretty);
10+
return diagnostic => {
11+
if (diagnostic.source === "typescript-to-lua") {
12+
diagnostic = { ...diagnostic, code: ("TL" + diagnostic.code) as any };
13+
}
14+
15+
reporter(diagnostic);
16+
};
1017
}
1118

1219
function createWatchStatusReporter(options?: ts.CompilerOptions): ts.WatchStatusReporter {

0 commit comments

Comments
 (0)