Commit Graph

14 Commits

Author SHA1 Message Date
Kat Marchán 824cd8bebe
feat(printer): use uparrow for empty highlights and fix 0-offset display bug 2021-09-07 17:41:28 -07:00
Kat Marchán 3f9da04b86
feat(report): anyhow-ify DiagnosticReport (#35)
This PR overhauls the toplevel/main experience for `miette`. It adds a new `Report` type based on `eyre::Report` and overhauls various types to fit into this model, as well as prepare for some [future changes in Rust](https://github.com/nrc/rfcs/pull/1) that will make it possible to integrate `miette` directly with crates like `eyre` instead of having to use this specific `Report`.

As such, this PR is a major breaking change, especially for anyone using `DiagnosticReport` and company.

BREAKING CHANGES:
* `DiagnosticReport` is now just `Report`, and is a different, `eyre::Report`-like type.
* `DiagnosticResult` is now just `Result`.
* `.into_diagnostic()` now just transforms the error into a `Report`.
* `DiagnosticReportPrinter` has been replaced with `ReportHandler`
* `set_printer` has been replaced by `set_hook`
* `code` is now optional.
* `.into_diagnostic()` no longer takes a `code` argument.
* `#[diagnostic]` is now optional when deriving `Diagnostic`.
2021-09-04 21:22:46 -07:00
Cormac Relf 84219f6c80
fix(printer): Show snippet message for unnamed sources (#39)
Fixes: https://github.com/zkat/miette/issues/38
2021-08-29 19:28:17 -07:00
Felipe Seré 5a474370dd
fix(reporter): Only inc the line count if we haven't already done so with '\n' or '\r\n' (#37) 2021-08-29 12:33:45 -07:00
Kat Marchán a05a6c519a
test: update tests to fit new api stuff 2021-08-22 19:31:03 -07:00
Tyler Bindon 9d6015996b
fix(printer): clamp highlight length to at least 1 (#32)
Fixes: https://github.com/zkat/miette/issues/31
2021-08-22 19:30:21 -07:00
Kat Marchán 61283e9efe
feat(snippets): Overhauled how snippets handle labels, sources, and messages, including the derive macro
BREAKING CHANGE: this will probably break a lot of your stuff. hopefully rustc helps
2021-08-22 19:06:47 -07:00
Kat Marchán 7e76e2dea4
feat(links): added URL linking support and automatic docs.rs link generation
Fixes: https://github.com/zkat/miette/issues/17
2021-08-22 15:42:08 -07:00
Kat Marchán 0fecc42f76
fmt: cargo fmt --all 2021-08-21 23:24:45 -07:00
Kat Marchán aafa4a3de1
feat(printer): rename default printer and consistify some naming conventions with printing
BREAKING CHANGE: This is a significant API break.
2021-08-21 22:52:06 -07:00
Kat Marchán 5369a9424e
feat(printer): added (and hooked up) an accessible report printer
Fixes: https://github.com/zkat/miette/issues/28
2021-08-21 15:32:31 -07:00
Kat Marchán b5c4118e59
misc: cargo fmt 2021-08-21 00:11:41 -07:00
Kat Marchán 5fbcd53026
feat(printer): lots of small improvements to printer 2021-08-20 23:52:15 -07:00
Kat Marchán d675334e48
feat(reporter): fancy new reporter with unicode, colors, and multiline (#23)
Fixes: https://github.com/zkat/miette/issues/3
Fixes: https://github.com/zkat/miette/issues/5
2021-08-20 20:09:23 -07:00