mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
feat: Add Deno.formatDiagnostics (#4032)
This commit is contained in:
parent
5da7c7df1d
commit
2b7e28b591
8 changed files with 83 additions and 7 deletions
|
@ -1,4 +1,5 @@
|
|||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
||||
import { DiagnosticItem } from "./diagnostics.ts";
|
||||
import * as dispatch from "./dispatch.ts";
|
||||
import { sendSync } from "./dispatch_json.ts";
|
||||
|
||||
|
@ -7,3 +8,11 @@ export function formatError(errString: string): string {
|
|||
const res = sendSync(dispatch.OP_FORMAT_ERROR, { error: errString });
|
||||
return res.error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format an array of diagnostic items and return them as a single string.
|
||||
* @param items An array of diagnostic items to format
|
||||
*/
|
||||
export function formatDiagnostics(items: DiagnosticItem[]): string {
|
||||
return sendSync(dispatch.OP_FORMAT_DIAGNOSTIC, { items });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue