2020-03-08 08:09:22 -04:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
|
|
|
import { DiagnosticItem } from "../diagnostics.ts";
|
|
|
|
import { sendSync } from "./dispatch_json.ts";
|
|
|
|
|
|
|
|
export function formatDiagnostics(items: DiagnosticItem[]): string {
|
|
|
|
return sendSync("op_format_diagnostic", { items });
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Location {
|
2020-04-13 10:54:16 -04:00
|
|
|
fileName: string;
|
|
|
|
lineNumber: number;
|
|
|
|
columnNumber: number;
|
2020-03-08 08:09:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export function applySourceMap(location: Location): Location {
|
2020-04-13 10:54:16 -04:00
|
|
|
const { fileName, lineNumber, columnNumber } = location;
|
2020-03-08 08:09:22 -04:00
|
|
|
const res = sendSync("op_apply_source_map", {
|
2020-04-13 10:54:16 -04:00
|
|
|
fileName,
|
|
|
|
lineNumber: lineNumber,
|
|
|
|
columnNumber: columnNumber,
|
2020-03-08 08:09:22 -04:00
|
|
|
});
|
|
|
|
return {
|
2020-04-13 10:54:16 -04:00
|
|
|
fileName: res.fileName,
|
|
|
|
lineNumber: res.lineNumber,
|
|
|
|
columnNumber: res.columnNumber,
|
2020-03-08 08:09:22 -04:00
|
|
|
};
|
|
|
|
}
|