Commit Graph

126 Commits

Author SHA1 Message Date
Kat Marchán 37cda4a3a4
fix(fmt): cargo fmt 2022-04-03 20:31:18 -07:00
Kat Marchán b98b098282
fix(clippy): misc clippy fixes 2022-04-03 18:33:51 -07:00
Finomnis b4a9d4cd9b
feat(report): Add conversion from Report to Box<dyn Error> (#149) 2022-04-03 13:10:32 -07:00
Bartek Iwańczuk 5151411ebb
feat: add fancy-no-backtrace feature (#144) 2022-03-22 12:30:52 -07:00
Christopher Durham 70e84f9a01
fix(handler): Apply MietteHandlerOpts::graphical_theme (#138)
Fixes: https://github.com/zkat/miette/issues/134
2022-03-18 16:30:00 -07:00
Christopher Durham b6a6cc9e75
feat(reporter): Allow GraphicalReportHandler to disable url display (#137) 2022-03-18 16:28:54 -07:00
Christopher Durham 209275d437
fix(colors): handler_opts.color(false) should disable color (#133) 2022-03-17 20:35:45 -07:00
Moritz Mœller 5d23c0d61d
fix(docs): Docs overhaul (#124)
* Fixed/formatted all intradoc links. Various other small doc fixes/typography/etc.

* Clarified semantic similarity with anyhow/eyre types/macros.

* Removed unused MietteError::SetPrinterFailure.

* README now generaed from lib.rs via `cargo readme`.

* More doc fixes, made ErrorHook type public.

* Indentation (docs).
2022-02-25 08:39:18 -08:00
Paul Colomiets 50bcec909a
fix(handlers): source code propagation for JSON handler (#122)
A part of fix of #99, follow up of #117
2022-02-22 16:06:29 -08:00
Paul Colomiets 75d4505e7d
feat(derive): allow `Report` in `related` (#121)
Fixes: #119
2022-02-21 19:12:37 -08:00
Paul Colomiets 3a17fceabb feat(handlers): propagate source code to related errors
Fixes #99
2022-02-19 16:58:48 -08:00
Paul Colomiets 50519264d4 feat(report): add `with_source_code`
Fixes #64
2022-02-19 16:58:48 -08:00
Kat Marchán 5c085b39e2
fix(graphical): boolean was messing up graphical display 2022-02-17 22:25:05 -08:00
Kyle Brown 5b8b5478b6
feat(derive): Make derive macro `diagnostic` attribute more flexible. (#115)
Fixes: #114 

* Improved defaulting

* Added correct combining logic
Added variable number of diagnostic attributes

* Error handling, testing, and docs improvements

Co-authored-by: Kyle Brown <kyleb@liquidrocketry.com>
2022-02-17 22:04:03 -08:00
Paul Colomiets 2649fd27c4
feat(Report): adds `.context()` method to the `Report` (#109)
Techically there was a hidden undocumented `context` method. But it was
just copied from the `eyre` and there is no evidence that it was used by
any user in miette (the method was an alias for `.handler()`).

Fixes #108
2022-01-17 17:16:08 -08:00
Paul Colomiets f158f4e370
fix(handlers): Fix label position (#107)
Fixes #106

While fixing the bug I've also extended the handler to print not just
where label starts but also where label ends.

Also implements #97, but for narratabble handler only.

This adds dependency on `unicode-width`, but it was already in the
dependency chain (`textwidth` depends on it). Although, previously it
was only for `"fancy"` feature, now it always required since narratable
handler is supported without `"fancy"`.
2022-01-17 11:07:29 -08:00
Kat Marchán 9dcce5f1bd
fix(colors): treat no-color mode as no-color instead of narratable (#94)
Fixes: https://github.com/zkat/miette/issues/93

BREAKING CHANGE: NO_COLOR no longer triggers the narrated handler. Use
NO_GRAPHICS instead.
2022-01-08 09:11:19 -08:00
Kat Marchán 51146535f5
fix(deps): switch to terminal_size 2022-01-07 17:47:56 -08:00
Paul Colomiets c205d2e71b
docs: fix mentions of eyre and DiagnosticError (#100)
Note: `DiagnosticError` is a private type, `Report` returned from
`into_diagnostic()` instead.
2022-01-07 17:35:48 -08:00
Paul Colomiets 645ef6a1b6
fix(json): proper escapes for JSON strings (#101)
Includes two fixes:
1. Things like `\n` are not doubly-escaped any more
2. The backslash `\` itself in the source is escaped
2022-01-07 17:35:24 -08:00
Paul Colomiets 52e5ec8064
fix(chain): correct `Chain` structure exported (#102)
This fixes all current complier and clippy warnings.
2022-01-07 17:34:39 -08:00
dvermd 53b246829a
feat(handlers): Add JSON handler (#90) 2021-11-15 08:49:22 -08:00
Kirill Vasiltsov 1f70140c2e
feat(tabs): Add replace tabs with spaces option (#82)
Fixes: https://github.com/zkat/miette/issues/73
2021-10-05 21:05:57 -07:00
Antoine Muller cb5a919deb
fix(read_span): prevent multilines MietteSpanContents from skipping lines (#81)
Fixes: https://github.com/zkat/miette/issues/76
2021-10-05 21:05:50 -07:00
Coenen Benjamin 0169fe20e7
feat(SourceSpan): add impl From<Range> (#78)
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2021-10-01 12:02:39 -07:00
Kat Marchán bb25edf019
docs: fix doctests 2021-09-26 13:00:39 -07:00
Kat Marchán 47e4d4d05c
docs: add docs for handler options 2021-09-26 12:45:18 -07:00
Kat Marchán 3213fa610a feat(narrated): global footer and related diagnostics support 2021-09-22 16:34:21 -07:00
Kat Marchán 612967d381 fix(deps): remove dep on itertools 2021-09-22 16:34:21 -07:00
Kat Marchán fbf6664ef5 feat(narrated): updated narrated handler 2021-09-22 16:34:21 -07:00
Kat Marchán b33084bdbf feat(handler): context lines config support 2021-09-22 16:34:21 -07:00
Kat Marchán b10693a91c tests: fix doctests and such 2021-09-22 16:34:21 -07:00
Kat Marchán eea5c29935 fix(read_span): fix off-by-one issue 2021-09-22 16:34:21 -07:00
Kat Marchán 77c5899bbd fix(graphical): render URLs even without a code 2021-09-22 16:34:21 -07:00
Kat Marchán ce0dea541a fix(theme): remove code styling 2021-09-22 16:34:21 -07:00
Kat Marchán 717f8e3d88 feat(graphical): add theming customization for linums 2021-09-22 16:34:21 -07:00
JT a69020422e fix(graphical): Fix off-by-one span_applies calculation (#70)
This changes the span_applies calculation to only count spans where the end of the span is considered part of it if the underline spills into it. I believe this happens if, say, the span.offset() is 10 and span.len() is 2, then we want to count offsets 10 and 11 as part of the span and those would spill, but not 12 as it's the "one past the end" where we know when to stop underlining.
2021-09-22 16:34:21 -07:00
Kat Marchán 55ca8e0b7f fix(api): put panic handler properly behind a flag 2021-09-22 16:34:21 -07:00
Kat Marchán 72c0bb9e65 feat(graphical): compact even more 2021-09-22 16:34:21 -07:00
Kat Marchán 41cb710a7d fix(context): get labels/snippets working when using .context() 2021-09-22 16:34:21 -07:00
Kat Marchán db637a366b feat(graphical): compact graphical display a bit 2021-09-22 16:34:21 -07:00
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 18e0ed7749 fix(graphical): fix coalescing adjacent things when they cross boundaries 2021-09-22 16:34:21 -07:00
Kat Marchán 6c6484633e feat(graphical): simplify graphical header and remove a dep 2021-09-22 16:34:21 -07:00
Kat Marchán e2e4027fda fix(graphical): stop rendering red vbars before the last item 2021-09-22 16:34:21 -07:00
Kat Marchán 858ac16935 feat(panic): add backtrace support to panic handler and move set_panic_hook into fancy features 2021-09-22 16:34:21 -07:00
Kat Marchán c6daee7b93 feat(panic): Add basic panic handler and installation function
Fixes: https://github.com/zkat/miette/issues/22
2021-09-22 16:34:21 -07:00
Kat Marchán 2cff68449c misc: remove stale comment 2021-09-22 16:34:21 -07:00
Kat Marchán 1a0f359e3c feat(report): nicer, non-overlapping same-line highlights 2021-09-22 16:34:21 -07:00
Kat Marchán 4bb9d12102 feat(handlers): Update graphical handler to use new label protocol (#66) 2021-09-22 16:34:21 -07:00