Bennett Hardwick
2e3e5c9d15
feat(protocol): add StdError impl for Box<dyn Diagnostic + Send + Sync> ( #273 )
2023-06-28 18:58:35 -07:00
Marcel Müller
aefe323780
feat(nested): Render inner diagnostics ( #170 )
2023-05-18 15:41:17 -07:00
kleines Filmröllchen
46adb3bc6a
feat(const): Constify various functions ( #263 )
...
This is primarily aimed at making `SourceSpan` and `SourceOffset` usable
in const contexts.
Constifiable functions were found with the
`clippy::missing_const_for_fn` lint, though it reported at least two
false positives.
2023-05-17 15:42:42 -07:00
Gavrilikhin Daniil
c25676cb1f
feat(serde): Add `serde` support ( #264 )
...
Fixes: https://github.com/zkat/miette/issues/260
2023-05-14 01:43:40 -07:00
Gavrilikhin Daniil
024145dbdd
Add dynamic diagnostic ( #262 )
2023-05-13 13:59:43 -07:00
Alexander Seiler
675f3411e3
fix(misc): Correct some typos ( #255 )
...
Signed-off-by: Alexander Seiler <seileralex@gmail.com>
2023-04-25 21:07:18 -07:00
Kat Marchán
adbff65e4e
fix(narrated): put URLs in their own line
...
This makes it easier for screen readers to access/visit.
2023-04-18 08:55:18 -07:00
Andrew Hickman
be3b254751
feat(source): Add getter for NamedSource name ( #252 )
2023-04-18 08:55:08 -07:00
Kat Marchán
b0453215f6
feat(panic): improved backtrace handling
...
Fixes: https://github.com/zkat/miette/issues/92
2023-03-31 17:08:20 -07:00
Aria Beingessner
0b445dc2b4
fix(tests): disable doctest that doesn't work with default feature flags ( #248 )
2023-03-30 09:19:51 -07:00
Aria Beingessner
159f2b354b
fix(colors): change unicode to default to ansi ( #249 )
2023-03-30 09:18:52 -07:00
Yoni Feng
566d6be6e3
misc(perf): nit perf improvements ( #244 )
2023-03-29 20:21:40 -07:00
George Pollard
443d240f49
fix(atty): Switch out `atty` for `is-terminal` ( #229 )
2023-03-13 21:10:21 -07:00
Erich Gubler
ed486c959d
feat(protocol): implement `Ord` for `Severity` ( #240 )
...
Fixes: https://github.com/zkat/miette/issues/239
2023-03-01 15:48:11 -08:00
dalance
3497508aa9
fix(graphical): Fix wrong severity of related errors ( #234 )
2023-02-08 16:26:27 -08:00
Lucas Kent
ebc61b5cf8
docs: Mention miette::miette! macro under "... in application code" ( #233 )
2023-01-30 10:21:50 -08:00
Benjamin Lee
8b56d277ef
fix(graphical): Fix panic with span extending past end of line ( #221 )
...
Fixes : #215
This also changes the behavior with spans including a CRLF line-ending.
Before the panic bug was introduced, these were rendered with the CRLF
being two visual columns wide. Now, any span extending past the EOL is
treated as including one extra visual column.
2022-11-23 16:35:13 -08:00
Sean Lynch
c857595e1a
feat(SourceCode): Implement SourceCode for Vec<u8> ( #216 )
2022-11-06 17:42:33 -08:00
Benjamin Lee
b8810ee3d8
fix(graphical): Fix panic with zero-width span at end of line ( #204 )
...
This was introduced in 196c09ce7a , and is
a simple off-by-one error.
2022-10-28 16:20:10 -07:00
Rain
ec7df952eb
tests: add tests to ensure that boxed reports forward all methods
...
In previous commits we found that boxed reports weren't forwarding every
method. Add a test to ensure that they do.
2022-10-24 19:04:51 -07:00
Rain
1a27033d7a
feat(error): impl AsRef<dyn StdError> for Report
...
This seems like an easy implementation to fill out, and will be used for
tests in the following commit.
2022-10-24 19:04:51 -07:00
Rain
3fc5c04cbb
fix(wrapper): complete forwarding Diagnostic implementations
...
They were missing `diagnostic_source()` which was recently added.
2022-10-24 19:04:51 -07:00
Rain
0660d2f43c
feat(report): `Report::new_boxed`
...
This is already currently accessible with `miette!`, but I missed that
because it isn't clearly documented. Add a constructor to mirror
`Report::new` and `Report::msg`.
2022-10-24 19:04:51 -07:00
Benjamin Lee
196c09ce7a
fix(graphical): Align highlights correctly with wide unicode characters and tabs ( #202 )
...
Fixes: https://github.com/zkat/miette/issues/97
Fixes: https://github.com/zkat/miette/issues/87
Tabs are always expanded to spaces by the graphical handler, and `tab_width` now defaults to 4. Instead of replacing every tab with a fixed number of spaces, spaces are used to align to the next tabstop. `tab_width` controls the space between tabstops rather than the fixed width of each tab character.
Co-authored-by: Benjamin Lee <benjamin@computer.surgery>
2022-09-10 14:20:37 -07:00
Nathan Whitaker
5f3429b062
fix(miri): Resolve Miri's concerns around unsafe code ( #197 )
2022-08-25 08:30:18 -07:00
Pig Fang
12279f83a8
docs: remove sentence about `cargo-edit` ( #198 )
2022-08-21 08:33:51 -07:00
Luca Palmieri
b9ea587159
feat(graphical): Allow miette users to opt-out of the rendering of the cause chain ( #192 )
...
Fixes: https://github.com/zkat/miette/issues/191
2022-08-09 17:32:02 -07:00
Andrew Hickman
c3e6c98336
fix(utils): Fix off-by-one error in SourceOffset::from_location ( #190 )
2022-08-02 14:38:22 -07:00
Leon Breedt
c95f58c87a
feat(json): `causes` support ( #188 )
...
Fixes: https://github.com/zkat/miette/issues/187
2022-07-31 11:47:06 -07:00
Kat Marchán
e286c705fd
fix(docs): readme was getting cut off during generation
...
Fixes: https://github.com/zkat/miette/issues/174
2022-07-24 10:24:07 -07:00
Rain
12dc40070a
fix(graphical): handle an empty source ( #183 )
...
In some cases the source can be completely empty -- handle that in a reasonable fashion.
2022-07-08 19:41:12 -07:00
Andrew Hickman
85da6a8407
feat(protocol): Implement SourceCode for Arc<str> (and similar types) ( #181 )
2022-06-25 10:58:56 -07:00
Benjamin Lee
1816b06a2e
feat(theme): restructure automatic color selection ( #177 )
...
Fixes: https://github.com/zkat/miette/issues/176
Change the default ansi color theme to use colors that are more similar
to the colors from the default RGB theme. In particular, don't use red
for any of the span labels, since that color is also used for errors.
BREAKING CHANGES:
* the default theme now prefers ANSI colors, even if RGB is supported
* `MietteHandlerOpts::ansi_colors` is removed
* `MietteHandlerOpts::rgb_color` now takes an enum that controls the
color format used when color support is enabled, and has no effect
otherwise.
2022-06-24 08:30:36 -07:00
Aria Beingessner
b193d3c002
fix(json): Don't escape single-quotes, that's not valid json ( #180 )
2022-06-24 08:28:01 -07:00
Kat Marchán
0a4cf4ad24
fix(tests): add Display impl to diagnostic_source example
2022-05-05 12:44:49 -07:00
Kat Marchán
a03bfe2e1b
docs: document new diagnostic_source feature
2022-05-05 08:56:27 -07:00
Matthias Beyer
bc449c8426
feat(diagnostic_source): add protocol method for Diagnostic-aware source chaining ( #165 )
...
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2022-05-05 08:32:37 -07:00
Matthias Beyer
33c8903313
fix: cargo fmt ( #168 )
...
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2022-05-05 08:30:13 -07:00
Marcel Müller
2451ad6a96
docs(IntoDiagnostic): Warn of potential data loss ( #161 )
...
Fixes: https://github.com/zkat/miette/issues/160
This patch expands on the effects of using IntoDiagnostic and warns
users of potential loss of information when using it on `Diagnostic`
types.
2022-04-23 11:35:39 -07:00
Kat Marchán
1a36fa7ec8
fix(graphical): fix issue with duplicate labels when span len is 0 ( #159 )
...
Fixes: https://github.com/zkat/miette/issues/130
2022-04-22 19:31:51 -07:00
Kat Marchán
084ed138b7
feat(related): print related prefixes according to severity ( #158 )
...
Fixes: https://github.com/zkat/miette/issues/139
2022-04-22 18:55:45 -07:00
Kat Marchán
1e1d615253
feat(spans): add From shorthand for zero-length SourceSpans
2022-04-22 18:44:09 -07:00
Kat Marchán
9da62cd05d
feat(label): use macro magic instead of optional flag for optional labels
2022-04-17 22:43:01 -07:00
Kat Marchán
ea55f458fa
feat(help): allow non-option values in #[help] fields
2022-04-17 22:43:01 -07:00
Kat Marchán
23ee3642d1
feat(labels): allow optional labels in derive macro ( #153 )
...
Fixes: https://github.com/zkat/miette/issues/110
2022-04-17 19:41:10 -07:00
Kat Marchán
45093c2f58
feat(help): update macro to allow optional help text ( #152 )
...
Fixes: https://github.com/zkat/miette/issues/148
2022-04-17 18:19:28 -07:00
Rain
5e54b29acf
feat(spans): make SourceSpan implement Copy ( #151 )
...
SourceSpan is just a pair of usizes, so it's cheap to copy.
2022-04-17 15:27:11 -07:00
Rain
97197601ee
fix(theme): set correct field in MietteHandlerOpts::ansi_colors ( #150 )
2022-04-13 17:21:22 -07:00
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
Kat Marchán
9aa8ff0d31
feat(protocol): Make SourceCode Send+Sync
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