mirror of
https://git.sfja.dk/Mikkel/slige.git
synced 2025-01-31 01:50:51 +00:00
28 lines
470 B
TypeScript
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 },
|
||
|
},
|
||
|
});
|