Commit Graph

50 Commits

Author SHA1 Message Date
Will Crichton 4c970fb4cf Add support for primary_label in specifying line/col information 2023-09-19 12:36:51 -07:00
Bruce Mitchener a9c2bae9dc
docs: Improve linking. (#289) 2023-09-18 09:12:56 -07:00
Bennett Hardwick 2e3e5c9d15
feat(protocol): add StdError impl for Box<dyn Diagnostic + Send + Sync> (#273) 2023-06-28 18:58:35 -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
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
Andrew Hickman c3e6c98336
fix(utils): Fix off-by-one error in SourceOffset::from_location (#190) 2022-08-02 14:38:22 -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
Kat Marchán 1e1d615253 feat(spans): add From shorthand for zero-length SourceSpans 2022-04-22 18:44:09 -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
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
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
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 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 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
Kat Marchán c3505fac26 fix(protocol): implement source/cause for Box<dyn Diagnostic> 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 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
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 949174e598
misc: more aggressive linting for quality~ 2021-08-21 23:13:25 -07:00
Kat Marchán 20bb3db3fa
docs: overhaul readme and make sure everything is documented
Fixes: https://github.com/zkat/miette/issues/15
2021-08-21 22:57:16 -07:00
Kat Marchán 5c077d30a4
fix(protocol): oops, missed a spot after a rename 2021-08-21 22:54:59 -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 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 26f409c525
feat(offsets): nice utility function to get an offset from a Rust callsite
Fixes: https://github.com/zkat/miette/issues/19
2021-08-17 19:18:57 -07:00
Kat Marchán 75c2312755
feat(offsets): utility function for converting from line/col to offset 2021-08-17 18:31:12 -07:00
Kat Marchán 95200366a1
feat(offsets): more utility From impls for SourceSpan 2021-08-17 18:30:38 -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 36b86df9f5
feat(protocol): implement From<(usize, usize)> for SourceSpan 2021-08-16 23:46:32 -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 02dd1f84d4
feat(protocol): Simplify protocol return values further
BREAKING CHANGE: Switched to Box instead of & for help/code return values.
2021-08-10 21:40:25 -04:00
Kat Marchán 3584dc600c
feat(protocol): improvements to snippets API 2021-08-07 22:59:20 -04:00
Kat Marchán 80e7dabbe4
feat(protocol): help is a single Display ref now. 2021-08-07 22:57:56 -04:00
Kat Marchán 7920a2315c
feat(protocol: Severity is now optional 2021-08-07 22:54:46 -04:00
Kat Marchán 781a51f037
fix(protocol): fix the default From<:T Diagnostic> implementation to cover more cases. 2021-08-05 13:24:37 -07:00
Kat Marchán 50238d75a2
feat(protocol): Make usafe of ? and return types with Diagnostics more ergonomic 2021-08-05 12:37:11 -07:00
Kat Marchán e955321cbd
fix(protocol): protocol improvements after getting feedback 2021-08-05 09:12:41 -07:00
Kat Marchán 6b51694733
feat(protocol) overhauled entire protocol to be based on byte offsets (#1)
Includes other improvements!

BREAKING CHANGE: Yeah this is pretty much a rewrite.
2021-08-04 20:27:12 -07:00
Kat Marchán 1cb0ad3852
feat(span): make span end optional 2021-08-03 12:56:56 -07:00
Kat Marchán a437f44511
feat(reporter): dummy reporter implementation + tests 2021-08-03 00:52:10 -07:00
Kat Marchán c3f41b972d
fix(protocol): use references forr all return values in Diagnostic 2021-08-02 23:20:15 -07:00
Kat Marchán e2387ce2ed
feat(protocol): sketched out a basic protocol 2021-08-02 23:08:51 -07:00