3 All notable changes to this project will be documented in this file.
5 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
10 ## [0.11.1] - 2021-01-18
14 - Add `Chars::{box_drawing, ascii}` functions, the latter supporting a rustc-style of
15 output that only uses ASCII characters (not above U+007F) for use cases that do not allow
16 for box drawing characters, e.g. terminals that do not support them.
20 - `Diagnostic::with_labels` and `Diagnostic::with_notes` now append additional
21 labels rather tan overwriting them, meaning that the documentation and behaviour match
22 more closely. The behaviour will only differ if you call the same builder methods
23 multiple times. If you call every builder method once only, nothing should change.
24 - `config::Chars::snippet_start` is now a String instead of a single `char`.
26 ## [0.11.0] - 2020-11-30
28 There is now a [code of conduct](https://github.com/brendanzab/codespan/blob/master/CODE_OF_CONDUCT.md)
29 and a [contributing guide](https://github.com/brendanzab/codespan/blob/master/CONTRIBUTING.md).
31 Some versions were skipped to sync up with the `codespan-lsp` crate. The release
32 process has been changed so this should not happen again.
36 - If a label spans over multiple lines, not all lines are rendered.
37 The number of lines rendered at beginning and end is configurable separately.
38 - There is now a custom error type.
39 - There now is a medium rendering mode that is like the short rendering mode
40 but also shows notes from the diagnostic.
41 - `PartialEq` and `Eq` implementations for the `diagnostic::{Diagnostic, Label, Severity}` types.
45 - All errors now use the error type `codespan_reporting::file::Error`.
46 This type also replaces the custom error type for `codespan-lsp`.
50 - Empty error codes are not rendered.
51 - The locus ("location of the diagnostic") is now computed so it is always at the first
52 primary label, or at the first secondary label if no primary labels are available.
53 - All `unwrap`s outside of tests and examples have been removed.
54 - Some internal improvements, including various code style improvements by using Clippy.
55 - Improved documentation, also mentioning how the ordering of labels is handled.
57 ## [0.9.5] - 2020-06-24
61 - Sections of source code that are marked with primary labels are now rendered
62 using the primary highlight color.
63 - Tab stops are now rendered properly.
65 We used to just render `\t` characters in source snippets with the same
69 <summary>Example</summary>
71 For example, when rendering with a tab width of `3` we
94 Now we properly take into account the column of the tab character:
118 ## [0.9.4] - 2020-05-18
122 - We have made the caret rendering easier to read when there are multiple
123 labels on the same line. We also avoid printing trailing borders on the
124 final source source snippet if no notes are present.
127 <summary>Example</summary>
134 3 │ v.push(v.pop().unwrap());
135 │ - first borrow later used by call
136 │ ---- first mutable borrow occurs here
137 │ ^ second mutable borrow occurs here
141 …we now render the following:
146 3 │ v.push(v.pop().unwrap());
147 │ - ---- ^ second mutable borrow occurs here
149 │ │ first mutable borrow occurs here
150 │ first borrow later used by call
157 - Diagnostic rendering no longer panics if label ranges are between UTF-8
158 character boundaries.
160 ## [0.9.3] - 2020-04-29
164 - Some panics were fixed when invalid unicode boundaries are supplied.
165 - Labels that marked the same span were originally rendered in reverse order.
166 This was a mistake! We've now fixed this.
169 <summary>Example</summary>
171 For example, this diagnostic:
182 …will now be rendered as:
195 - We've reduced the prominence of the 'locus' on source snippets by
196 simplifying the border and reducing the spacing around it. This is to help
197 focus attention on the underlined source snippet and error messages, rather
198 than the location, which should be a secondary focus.
201 <summary>Example</summary>
203 For example we originally rendered this:
206 error: unknown builtin: `NATRAL`
208 ┌── Data/Nat.fun:7:13 ───
210 7 │ {-# BUILTIN NATRAL Nat #-}
211 │ ^^^^^^ unknown builtin
213 = there is a builtin with a similar name: `NATURAL`
217 …and now we render this:
220 error: unknown builtin: `NATRAL`
223 7 │ {-# BUILTIN NATRAL Nat #-}
224 │ ^^^^^^ unknown builtin
226 = there is a builtin with a similar name: `NATURAL`
232 ## [0.9.2] - 2020-03-29
236 - Render overlapping multiline marks on the same lines of source code.
239 <summary>Example</summary>
244 error[E0308]: match arms have incompatible types
246 ┌── codespan/src/file.rs:1:9 ───
248 1 │ ╭ match line_index.compare(self.last_line_index()) {
249 2 │ │ Ordering::Less => Ok(self.line_starts()[line_index.to_usize()]),
250 3 │ │ Ordering::Equal => Ok(self.source_span().end()),
251 4 │ │ Ordering::Greater => LineIndexOutOfBoundsError {
252 5 │ │ given: line_index,
253 6 │ │ max: self.last_line_index(),
256 │ ╰─────────' `match` arms have incompatible types
258 2 │ Ordering::Less => Ok(self.line_starts()[line_index.to_usize()]),
259 │ --------------------------------------------- this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>`
260 3 │ Ordering::Equal => Ok(self.source_span().end()),
261 │ ---------------------------- this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>`
262 4 │ Ordering::Greater => LineIndexOutOfBoundsError {
263 │ ╭──────────────────────────────────^
264 5 │ │ given: line_index,
265 6 │ │ max: self.last_line_index(),
267 │ ╰─────────────^ expected enum `Result`, found struct `LineIndexOutOfBoundsError`
269 = expected type `Result<ByteIndex, LineIndexOutOfBoundsError>`
270 found type `LineIndexOutOfBoundsError`
276 error[E0308]: match arms have incompatible types
278 ┌── codespan/src/file.rs:1:9 ───
280 1 │ ╭ match line_index.compare(self.last_line_index()) {
281 2 │ │ Ordering::Less => Ok(self.line_starts()[line_index.to_usize()]),
282 │ │ --------------------------------------------- this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>`
283 3 │ │ Ordering::Equal => Ok(self.source_span().end()),
284 │ │ ---------------------------- this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>`
285 4 │ │ Ordering::Greater => LineIndexOutOfBoundsError {
286 │ ╭─│──────────────────────────────────^
287 5 │ │ │ given: line_index,
288 6 │ │ │ max: self.last_line_index(),
290 │ ╰─│─────────────^ expected enum `Result`, found struct `LineIndexOutOfBoundsError`
292 │ ╰─────────' `match` arms have incompatible types
294 = expected type `Result<ByteIndex, LineIndexOutOfBoundsError>`
295 found type `LineIndexOutOfBoundsError`
300 ## [0.9.1] - 2020-03-23
304 - `codespan_reporting::diagnostic::Diagnostic` now implements `Debug`.
308 - Single-line labels are now rendered together, under the same source line.
311 <summary>Example</summary>
316 ┌── one_line.rs:3:5 ───
318 3 │ v.push(v.pop().unwrap());
319 │ - first borrow later used by call
321 3 │ v.push(v.pop().unwrap());
322 │ ---- first mutable borrow occurs here
324 3 │ v.push(v.pop().unwrap());
325 │ ^ second mutable borrow occurs here
332 ┌── one_line.rs:3:5 ───
334 3 │ v.push(v.pop().unwrap());
335 │ - first borrow later used by call
336 │ ---- first mutable borrow occurs here
337 │ ^ second mutable borrow occurs here
343 ## [0.9.0] - 2020-03-11
347 - The `codespan_reporting::files` module was added as a way to decouple
348 `codespan_reporting` from `codespan`.
349 - `codespan_reporting::files::Files` allows users to implement custom file
350 databases that work with `codespan_reporting`. This should make it
351 easier to integrate with libraries like Salsa, and also makes it less
352 invasive to use `codespan_reporting` on existing projects.
353 - `codespan_reporting::files::SimpleFile` is a simple implementation of
354 `codespan_reporting::files::Files` where only a single file is needed.
355 - `codespan_reporting::files::SimpleFiles` is a simple implementation of
356 `codespan_reporting::files::Files` where multiple files are needed.
360 - The `codespan_reporting::diagnostic` module has been greatly revamped,
361 making the builder API format more nicely with rustfmt, and allowing for
362 multiple primary labels.
363 - The output of `codespan_reporting::term::emit` was improved,
364 with the following changes:
365 - labels on consecutive lines no longer render breaks between them
366 - source lines are rendered when there is only one line between labels
367 - the inner gutter of code snippets is now aligned consistently
368 - the outer gutter of consecutive code snippets are now aligned consistently
369 - `codespan_reporting::term::emit` now takes writers as a trait object (rather
370 than using static dispatch) in order to reduce coda bloat and improve
372 - The field names in `codespan_reporting::term::Chars` were tweaked for
377 - `codespan_reporting` no longer depends on `codespan`.
378 Note that `codespan` can _still_ be used with `codespan_reporting`,
379 as `codespan::Files` now implements `codespan_reporting::files::Files`.
381 ## [0.8.0] - 2020-02-24
382 ## [0.7.0] - 2020-01-06
383 ## [0.6.0] - 2019-12-18
384 ## [0.5.0] - 2019-10-02
385 ## [0.4.1] - 2019-08-25
386 ## [0.4.0] - 2019-08-22
387 ## [0.3.0] - 2019-05-01
388 ## [0.2.1] - 2019-02-26
389 ## [0.2.0] - 2018-10-11
391 [Unreleased]: https://github.com/brendanzab/codespan/compare/v0.11.1...HEAD
392 [0.11.1]: https://github.com/brendanzab/codespan/compare/v0.11.0..v0.11.1
393 [0.11.0]: https://github.com/brendanzab/codespan/compare/v0.9.5...v0.11.0
394 [0.9.5]: https://github.com/brendanzab/codespan/compare/v0.9.4...v0.9.5
395 [0.9.4]: https://github.com/brendanzab/codespan/compare/v0.9.3...v0.9.4
396 [0.9.3]: https://github.com/brendanzab/codespan/compare/v0.9.2...v0.9.3
397 [0.9.2]: https://github.com/brendanzab/codespan/compare/v0.9.1...v0.9.2
398 [0.9.1]: https://github.com/brendanzab/codespan/compare/v0.9.0...v0.9.1
399 [0.9.0]: https://github.com/brendanzab/codespan/compare/v0.8.0...v0.9.0
400 [0.8.0]: https://github.com/brendanzab/codespan/compare/v0.7.0...v0.8.0
401 [0.7.0]: https://github.com/brendanzab/codespan/compare/v0.6.0...v0.7.0
402 [0.6.0]: https://github.com/brendanzab/codespan/compare/v0.5.0...v0.6.0
403 [0.5.0]: https://github.com/brendanzab/codespan/compare/v0.4.1...v0.5.0
404 [0.4.1]: https://github.com/brendanzab/codespan/compare/v0.4.0...v0.4.1
405 [0.4.0]: https://github.com/brendanzab/codespan/compare/v0.3.0...v0.4.0
406 [0.3.0]: https://github.com/brendanzab/codespan/compare/v0.2.1...v0.3.0
407 [0.2.1]: https://github.com/brendanzab/codespan/compare/v0.2.0...v0.2.1
408 [0.2.0]: https://github.com/brendanzab/codespan/releases/tag/v0.2.0