We've skipped some versions for `codespan-reporting` and `codespan` to get the crate versions back in sync with `codespan-lsp`.
Co-authored-by: Johann150 <20990607+Johann150@users.noreply.github.com>
- move error to files module; removed the special error types from codespan-lsp
- use error type in codespan and codespan-lsp
- make dependency on codespan-reporting non-optional
Just looked through all closed pull requests since the last release.
Left out anything related to codespan-lsp since there were already versions released for that.
I assume the changelog for that has been maintained.
* Skip lines if there are too many lines in a label
The number of lines of context which are displayed should probably be configurable.
* make lines of context configurable
This changes the Config data structure and might be a breaking change.
* fix calculation of which lines to show
* fix formatting
* change the implementation to actually work
* start adding tests
* complete tests
* correctly filter lines
never skip lines which contain SingleLabel:s
if there is a single empty line, get back filtered out labels
* fix typo in comment
* simplify test
* continue labels across breaks
* better naming and more comments
* remove stray tests
* match test to usual pattern
* reviewed test
* store omittability on line instead of single label
This makes the code less complicated.
* separate configuration for start and end
* test separate configuration options
* improve documentation and comments
* simplify label retrieval
* change omittable to must_render
* remove current_labels
* add fixme comments
Co-authored-by: Brendan Zabarauskas <bjzaba@yahoo.com.au>
* simplify empty array
Co-authored-by: Brendan Zabarauskas <bjzaba@yahoo.com.au>
This makes the rendering of carets smarter when there are multiple labels on the same line. Instead of this:
```
┌─ one_line.rs:3:5
│
3 │ v.push(v.pop().unwrap());
│ - first borrow later used by call
│ ---- first mutable borrow occurs here
│ ^ second mutable borrow occurs here
│
```
...we now render the following:
```
┌─ one_line.rs:3:5
│
3 │ v.push(v.pop().unwrap());
│ - ---- ^ second mutable borrow occurs here
│ │ │
│ │ first mutable borrow occurs here
│ first borrow later used by call
│
```
This omits the trailing border on the final snippet if no notes are present.
For example, originally we’d render:
```
error[E0499]: cannot borrow `v` as mutable more than once at a time
┌─ one_line.rs:3:5
│
3 │ v.push(v.pop().unwrap());
│ - first borrow later used by call
│ ---- first mutable borrow occurs here
│ ^ second mutable borrow occurs here
│
error: aborting due to previous error
= For more information about this error, try `rustc --explain E0499`.
```
…where as now we’ll render:
```
error[E0499]: cannot borrow `v` as mutable more than once at a time
┌─ one_line.rs:3:5
│
3 │ v.push(v.pop().unwrap());
│ - first borrow later used by call
│ ---- first mutable borrow occurs here
│ ^ second mutable borrow occurs here
error: aborting due to previous error
= For more information about this error, try `rustc --explain E0499`.
```
This eliminates the spacing between the title and the locus, and the outer spacing to the left of the source numbers.
Originally we would render this:
```
error: unknown builtin: `NATRAL`
┌─ Data/Nat.fun:7:13
│
7 │ {-# BUILTIN NATRAL Nat #-}
│ ^^^^^^ unknown builtin
│
= there is a builtin with a similar name: `NATURAL`
```
And now we render this:
```
error: unknown builtin: `NATRAL`
┌─ Data/Nat.fun:7:13
│
7 │ {-# BUILTIN NATRAL Nat #-}
│ ^^^^^^ unknown builtin
│
= there is a builtin with a similar name: `NATURAL`
```