slige/compiler/test_diagnostics.ts
2025-01-23 10:28:48 +01:00

28 lines
470 B
TypeScript

import { Ctx } from "./ctx.ts";
import { prettyPrintReport } from "./diagnostics.ts";
const ctx = new Ctx();
const text = `
make an error here
`;
const file = ctx.addFile(
"root",
"path/file.ts",
"path/file.ts",
undefined,
text,
);
prettyPrintReport(ctx, {
file,
msg: "an error",
severity: "error",
origin: "compiler",
span: {
begin: { idx: 6, line: 2, col: 6 },
end: { idx: 13, line: 2, col: 13 },
},
});