• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Changelog
2
3All notable changes to this project will be documented in this file.
4
5The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
8## [Unreleased]
9
10## [0.11.0] - 2020-11-30
11
12There is now a [code of conduct](https://github.com/brendanzab/codespan/blob/master/CODE_OF_CONDUCT.md)
13and a [contributing guide](https://github.com/brendanzab/codespan/blob/master/CONTRIBUTING.md).
14
15Some versions were skipped to sync up with the `codespan-lsp` crate. The release
16process has been changed so this should not happen again.
17
18### Added
19
20-   If a label spans over multiple lines, not all lines are rendered.
21    The number of lines rendered at beginning and end is configurable separately.
22-   There is now a custom error type.
23-   There now is a medium rendering mode that is like the short rendering mode
24    but also shows notes from the diagnostic.
25-   `PartialEq` and `Eq` implementations for the `diagnostic::{Diagnostic, Label, Severity}` types.
26
27### Changed
28
29-   All errors now use the error type `codespan_reporting::file::Error`.
30    This type also replaces the custom error type for `codespan-lsp`.
31
32### Fixed
33
34-   Empty error codes are not rendered.
35-   The locus ("location of the diagnostic") is now computed so it is always at the first
36    primary label, or at the first secondary label if no primary labels are available.
37-   All `unwrap`s outside of tests and examples have been removed.
38-   Some internal improvements, including various code style improvements by using Clippy.
39-   Improved documentation, also mentioning how the ordering of labels is handled.
40
41## [0.9.5] - 2020-06-24
42
43### Changed
44
45-   Sections of source code that are marked with primary labels are now rendered
46    using the primary highlight color.
47-   Tab stops are now rendered properly.
48
49    We used to just render `\t` characters in source snippets with the same
50    number of spaces. For example, when rendering with a tab width of `3` we
51    would print:
52    ```
53    warning: tab test
54      ┌─ tab_columns:1:2
5556    1 │    hello
57      │    ^^^^^
58    2 │ ∙   hello
59      │     ^^^^^
60    3 │ ∙∙   hello
61      │      ^^^^^
62    4 │ ∙∙∙   hello
63      │       ^^^^^
64    5 │ ∙∙∙∙   hello
65      │        ^^^^^
66    6 │ ∙∙∙∙∙   hello
67      │         ^^^^^
68    7 │ ∙∙∙∙∙∙   hello
69      │          ^^^^^
70    ```
71    Now we properly take into account the column of the tab character:
72    ```
73    warning: tab test
74      ┌─ tab_columns:1:2
7576    1 │    hello
77      │    ^^^^^
78    2 │ ∙  hello
79      │    ^^^^^
80    3 │ ∙∙ hello
81      │    ^^^^^
82    4 │ ∙∙∙   hello
83      │       ^^^^^
84    5 │ ∙∙∙∙  hello
85      │       ^^^^^
86    6 │ ∙∙∙∙∙ hello
87      │       ^^^^^
88    7 │ ∙∙∙∙∙∙   hello
89      │          ^^^^^
90    ```
91
92## [0.9.4] - 2020-05-18
93
94### Changed
95
96-   We have made the caret rendering easier to read when there are multiple
97    labels on the same line. We also avoid printing trailing borders on the
98    final source source snippet if no notes are present. Instead of this:
99    ```
100       ┌─ one_line.rs:3:5
101102     3 │     v.push(v.pop().unwrap());
103       │     - first borrow later used by call
104       │       ---- first mutable borrow occurs here
105       │            ^ second mutable borrow occurs here
106107    ```
108    …we now render the following:
109    ```
110       ┌─ one_line.rs:3:5
111112     3 │     v.push(v.pop().unwrap());
113       │     - ---- ^ second mutable borrow occurs here
114       │     │ │
115       │     │ first mutable borrow occurs here
116       │     first borrow later used by call
117    ```
118
119### Fixed
120
121-   Diagnostic rendering no longer panics if label ranges are between UTF-8
122    character boundaries.
123
124## [0.9.3] - 2020-04-29
125
126### Changed
127
128-   Some panics were fixed when invalid unicode boundaries are supplied.
129-   Labels that marked the same span were originally rendered in reverse order.
130    This was a mistake! We've now fixed this.
131
132    For example, this diagnostic:
133    ```
134       ┌─ same_range:1:7
135136     1 │ ::S { }
137       │     - Expected '('
138       │     ^ Unexpected '{'
139140    ```
141    …will now be rendered as:
142    ```
143       ┌─ same_range:1:7
144145     1 │ ::S { }
146       │     ^ Unexpected '{'
147       │     - Expected '('
148149    ```
150
151-   We've reduced the prominence of the 'locus' on source snippets by
152    simplifying the border and reducing the spacing around it. This is to help
153    focus attention on the underlined source snippet and error messages, rather
154    than the location, which should be a secondary focus.
155
156    For example we originally rendered this:
157    ```
158    error: unknown builtin: `NATRAL`
159
160       ┌── Data/Nat.fun:7:13 ───
161162     7 │ {-# BUILTIN NATRAL Nat #-}
163       │             ^^^^^^ unknown builtin
164165       = there is a builtin with a similar name: `NATURAL`
166
167    ```
168    …and now we render this:
169    ```
170    error: unknown builtin: `NATRAL`
171      ┌─ Data/Nat.fun:7:13
172173    7 │ {-# BUILTIN NATRAL Nat #-}
174      │             ^^^^^^ unknown builtin
175176      = there is a builtin with a similar name: `NATURAL`
177
178    ```
179
180## [0.9.2] - 2020-03-29
181
182### Changed
183
184-   Render overlapping multiline marks on the same lines of source code.
185
186    For example:
187    ```
188    error[E0308]: match arms have incompatible types
189
190       ┌── codespan/src/file.rs:1:9 ───
191192     1 │ ╭         match line_index.compare(self.last_line_index()) {
193     2 │ │             Ordering::Less => Ok(self.line_starts()[line_index.to_usize()]),
194     3 │ │             Ordering::Equal => Ok(self.source_span().end()),
195     4 │ │             Ordering::Greater => LineIndexOutOfBoundsError {
196     5 │ │                 given: line_index,
197     6 │ │                 max: self.last_line_index(),
198     7 │ │             },
199     8 │ │         }
200       │ ╰─────────' `match` arms have incompatible types
201       ·
202     2 │               Ordering::Less => Ok(self.line_starts()[line_index.to_usize()]),
203       │                                 --------------------------------------------- this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>`
204     3 │               Ordering::Equal => Ok(self.source_span().end()),
205       │                                  ---------------------------- this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>`
206     4 │               Ordering::Greater => LineIndexOutOfBoundsError {
207       │ ╭──────────────────────────────────^
208     5 │ │                 given: line_index,
209     6 │ │                 max: self.last_line_index(),
210     7 │ │             },
211       │ ╰─────────────^ expected enum `Result`, found struct `LineIndexOutOfBoundsError`
212213       = expected type `Result<ByteIndex, LineIndexOutOfBoundsError>`
214            found type `LineIndexOutOfBoundsError`
215    ```
216    …is now rendered as:
217    ```
218    error[E0308]: match arms have incompatible types
219
220       ┌── codespan/src/file.rs:1:9 ───
221222     1 │   ╭         match line_index.compare(self.last_line_index()) {
223     2 │   │             Ordering::Less => Ok(self.line_starts()[line_index.to_usize()]),
224       │   │                               --------------------------------------------- this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>`
225     3 │   │             Ordering::Equal => Ok(self.source_span().end()),
226       │   │                                ---------------------------- this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>`
227     4 │   │             Ordering::Greater => LineIndexOutOfBoundsError {
228       │ ╭─│──────────────────────────────────^
229     5 │ │ │                 given: line_index,
230     6 │ │ │                 max: self.last_line_index(),
231     7 │ │ │             },
232       │ ╰─│─────────────^ expected enum `Result`, found struct `LineIndexOutOfBoundsError`
233     8 │   │         }
234       │   ╰─────────' `match` arms have incompatible types
235236       = expected type `Result<ByteIndex, LineIndexOutOfBoundsError>`
237            found type `LineIndexOutOfBoundsError`
238    ```
239
240## [0.9.1] - 2020-03-23
241
242### Added
243
244-   `codespan_reporting::diagnostic::Diagnostic` now implements `Debug`.
245
246### Changed
247
248-   Single-line labels are now rendered together, under the same source line.
249
250    For example:
251    ```
252       ┌── one_line.rs:3:5 ───
253254     3 │     v.push(v.pop().unwrap());
255       │     - first borrow later used by call
256       ·
257     3 │     v.push(v.pop().unwrap());
258       │       ---- first mutable borrow occurs here
259       ·
260     3 │     v.push(v.pop().unwrap());
261       │            ^ second mutable borrow occurs here
262263    ```
264    …is now rendered as:
265    ```
266       ┌── one_line.rs:3:5 ───
267268     3 │     v.push(v.pop().unwrap());
269       │     - first borrow later used by call
270       │       ---- first mutable borrow occurs here
271       │            ^ second mutable borrow occurs here
272273    ```
274
275## [0.9.0] - 2020-03-11
276
277### Added
278
279-   The `codespan_reporting::files` module was added as a way to decouple
280    `codespan_reporting` from `codespan`.
281    -   `codespan_reporting::files::Files` allows users to implement custom file
282        databases that work with `codespan_reporting`. This should make it
283        easier to integrate with libraries like Salsa, and also makes it less
284        invasive to use `codespan_reporting` on existing projects.
285    -   `codespan_reporting::files::SimpleFile` is a simple implementation of
286        `codespan_reporting::files::Files` where only a single file is needed.
287    -   `codespan_reporting::files::SimpleFiles` is a simple implementation of
288        `codespan_reporting::files::Files` where multiple files are needed.
289
290### Changed
291
292-   The `codespan_reporting::diagnostic` module has been greatly revamped,
293    making the builder API format more nicely with rustfmt, and allowing for
294    multiple primary labels.
295-   The output of `codespan_reporting::term::emit` was improved,
296    with the following changes:
297    -   labels on consecutive lines no longer render breaks between them
298    -   source lines are rendered when there is only one line between labels
299    -   the inner gutter of code snippets is now aligned consistently
300    -   the outer gutter of consecutive code snippets are now aligned consistently
301-   `codespan_reporting::term::emit` now takes writers as a trait object (rather
302    than using static dispatch) in order to reduce coda bloat and improve
303    compile times.
304-   The field names in `codespan_reporting::term::Chars` were tweaked for
305    consistency.
306
307### Removed
308
309-   `codespan_reporting` no longer depends on `codespan`.
310    Note that `codespan` can _still_ be used with `codespan_reporting`,
311    as `codespan::Files` now implements `codespan_reporting::files::Files`.
312
313## [0.8.0] - 2020-02-24
314## [0.7.0] - 2020-01-06
315## [0.6.0] - 2019-12-18
316## [0.5.0] - 2019-10-02
317## [0.4.1] - 2019-08-25
318## [0.4.0] - 2019-08-22
319## [0.3.0] - 2019-05-01
320## [0.2.1] - 2019-02-26
321## [0.2.0] - 2018-10-11
322
323[Unreleased]: https://github.com/brendanzab/codespan/compare/v0.11.0...HEAD
324[0.11.0]: https://github.com/brendanzab/codespan/compare/v0.9.5...v0.11.0
325[0.9.5]: https://github.com/brendanzab/codespan/compare/v0.9.4...v0.9.5
326[0.9.4]: https://github.com/brendanzab/codespan/compare/v0.9.3...v0.9.4
327[0.9.3]: https://github.com/brendanzab/codespan/compare/v0.9.2...v0.9.3
328[0.9.2]: https://github.com/brendanzab/codespan/compare/v0.9.1...v0.9.2
329[0.9.1]: https://github.com/brendanzab/codespan/compare/v0.9.0...v0.9.1
330[0.9.0]: https://github.com/brendanzab/codespan/compare/v0.8.0...v0.9.0
331[0.8.0]: https://github.com/brendanzab/codespan/compare/v0.7.0...v0.8.0
332[0.7.0]: https://github.com/brendanzab/codespan/compare/v0.6.0...v0.7.0
333[0.6.0]: https://github.com/brendanzab/codespan/compare/v0.5.0...v0.6.0
334[0.5.0]: https://github.com/brendanzab/codespan/compare/v0.4.1...v0.5.0
335[0.4.1]: https://github.com/brendanzab/codespan/compare/v0.4.0...v0.4.1
336[0.4.0]: https://github.com/brendanzab/codespan/compare/v0.3.0...v0.4.0
337[0.3.0]: https://github.com/brendanzab/codespan/compare/v0.2.1...v0.3.0
338[0.2.1]: https://github.com/brendanzab/codespan/compare/v0.2.0...v0.2.1
339[0.2.0]: https://github.com/brendanzab/codespan/releases/tag/v0.2.0
340