Commit Graph

61 Commits

Author SHA1 Message Date
Kat Marchán 8e11baab7b feat(related): Add related diagnostics (#68)
Fixes: https://github.com/zkat/miette/issues/47
2021-09-22 16:34:21 -07:00
Kat Marchán 3a901ace68 tests: more testing 2021-09-22 16:34:21 -07:00
Kat Marchán 49f635fb65 tests: rename printer.rs to graphical.rs 2021-09-22 16:34:21 -07:00
Kat Marchán 0544d7654e tests: update printer tests so they compile 2021-09-22 16:34:21 -07:00
Kat Marchán f87b158b22 feat(labels): replace snippet stuff with simpler labels (#62) 2021-09-22 16:34:21 -07:00
Kat Marchán cd69a8ae92 test: prefix Error: to make things look more accurate 2021-09-22 16:34:21 -07:00
Kat Marchán 2c43740346 feat(theme): more styling changes 2021-09-22 16:34:21 -07:00
Kat Marchán 559113bd1c tests: add test for wide character support 2021-09-22 16:34:21 -07:00
Kat Marchán 93374173e3 feat(footer): add footer support to graphical and narrated
Fixes: https://github.com/zkat/miette/issues/34
2021-09-22 16:34:21 -07:00
Kat Marchán 247e8f8b39 feat(deps): move fancy reporter (and its deps) to a feature
BREAKING CHANGE: The default fancy reporter is no longer available unless you enable the "fancy" feature. This also means you will not be pulling in a bunch of deps if you are using miette for a library

Fixes: https://github.com/zkat/miette/issues/25
2021-09-22 16:34:21 -07:00
Kat Marchán 4c2463f9ae feat(report): make a single big MietteHandler that can switch modes
BREAKING CHANGE: linkification option method on GraphicalReportHandler has been changed to .with_links(bool)
2021-09-22 16:34:21 -07:00
Kat Marchán 643e769a80
tests: update tests after shortening header because of Error: 2021-09-13 17:49:38 -07:00
Cormac Relf 2fa5551c81
feat(derive): Add `#[diagnostic(forward(field_name), code(...))]` (#41) 2021-09-13 15:39:04 -07:00
Robin Appelman d994add912
fix(report): Fix end of previous line wrongly being included in highlight (#52) 2021-09-13 09:57:54 -07:00
Kat Marchán eaebde92cf
feat(report): make header line as wide as terminal 2021-09-10 17:09:52 -07:00
Kat Marchán bc72532465
feat(report): take terminal width into account for wrapping text 2021-09-10 12:39:10 -07:00
Kat Marchán f482dcec6a
feat(report): wrap multiline messages to keep formatting
Fixes: https://github.com/zkat/miette/issues/51
2021-09-10 08:16:40 -07:00
Kat Marchán 1ba3f2f5d2
fix(report): get rid of the weird arrow thing. it does not look good 2021-09-10 07:36:09 -07:00
Kat Marchán 533ff5f348
fix(reporter): improve color situation and style things a little nicer 2021-09-08 20:59:19 -07:00
Kat Marchán 00ebb13ea6
tests: have at least one test with multiple causes 2021-09-08 19:46:04 -07:00
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
Cormac Relf 53f5d6d1d6
feat(derive): Add `#[diagnostic(transparent,forward)]` (#36)
Fixes: https://github.com/zkat/miette/issues/16
2021-08-29 12:33:16 -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 adf0bc933f
fix(derive): #[diagnosic(severity)] works for named and unnamed variants/structs now
Fixes: https://github.com/zkat/miette/issues/26
2021-08-21 17:18:12 -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
Kat Marchán 8fbad1b1cd
feat(derive): format string support for help()
Fixes: https://github.com/zkat/miette/issues/7
2021-08-18 19:59:50 -07:00
Kat Marchán 29c1403efd
feat(reporter): Overhauled return type/main/DiagnosticReport experience.
Fixes: https://github.com/zkat/miette/issues/13
2021-08-17 23:41:03 -07:00
Kat Marchán 385171eb81
feat(derive): Allow anything Clone + Into<SourceSpan> to be used as a Span
Fixes: https://github.com/zkat/miette/issues/12
2021-08-17 19:30:22 -07:00
Kat Marchán 53074d3488
feat(protocol): add Source impls for Cow and Arc 2021-08-17 17:54:29 -07:00
Kat Marchán 49151bb095
fix(protocol): keep the owned spans 2021-08-17 17:15:05 -07:00
Kat Marchán f390520b45
feat(protocol): reference-based DiagnosticReport! 2021-08-17 15:30:52 -07:00
Kat Marchán acfeb9c5b0
feat(protocol): new SourceSpans with labels 2021-08-17 08:41:20 -07:00
Kat Marchán f6e6acf2d2
feat(derive): Support for deriving snippet method (#18)
Fixes: #11
2021-08-16 22:20:13 -07:00
Kat Marchán 3e5ee0ee4d
fmt: cargo fmt --all 2021-08-15 21:08:53 -07:00
Kat Marchán 9ef0dd261f
feat(derive): improved derive support, including partial help format string support! 2021-08-15 18:15:50 -07:00
Kat Marchán 9a78a94395
fix(derive): move to plain syn to fix darling issues 2021-08-15 17:27:39 -07:00
Kat Marchán 0e7702700d
feat(derive): added basic derive macro
This should be good for most basic use cases. More features will be added over time :)
2021-08-15 11:49:02 -07:00
Kat Marchán d201dde4b5
fix(reporter): fix reporter and tests... again 2021-08-10 22:47:28 -04:00
Kat Marchán 0d2e3312a4
fix(reporter): fix extra newline after header 2021-08-10 22:04:28 -04:00