-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Group labels originating from the same file into a single snippet #100
Comments
This was referenced Jun 24, 2019
Closed
This was referenced Aug 26, 2019
Merged
This seems like it could be a helpful library: https://crates.io/crates/nested_intervals - or at least thinking about this stuff in terms of interval sets... 🤔 |
This was referenced Feb 26, 2020
Merged
brendanzab
added a commit
that referenced
this issue
Mar 9, 2020
Working towards #100, this slightly cleans up the rendering of diagnostics with multiple labels.
brendanzab
added a commit
that referenced
this issue
Mar 9, 2020
Working towards #100, this slightly cleans up the rendering of diagnostics with multiple labels.
This was referenced Mar 9, 2020
Making progress on this on my overlapping-maks branch:
|
brendanzab
added a commit
that referenced
this issue
Mar 24, 2020
This renders overlapping multiline marks on the same lines of source code. This means that the following example: ``` error[E0308]: match arms have incompatible types ┌── codespan/src/file.rs:1:9 ─── │ 1 │ ╭ match line_index.compare(self.last_line_index()) { 2 │ │ Ordering::Less => Ok(self.line_starts()[line_index.to_usize()]), 3 │ │ Ordering::Equal => Ok(self.source_span().end()), 4 │ │ Ordering::Greater => LineIndexOutOfBoundsError { 5 │ │ given: line_index, 6 │ │ max: self.last_line_index(), 7 │ │ }, 8 │ │ } │ ╰─────────' `match` arms have incompatible types · 2 │ Ordering::Less => Ok(self.line_starts()[line_index.to_usize()]), │ --------------------------------------------- this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>` 3 │ Ordering::Equal => Ok(self.source_span().end()), │ ---------------------------- this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>` 4 │ Ordering::Greater => LineIndexOutOfBoundsError { │ ╭──────────────────────────────────^ 5 │ │ given: line_index, 6 │ │ max: self.last_line_index(), 7 │ │ }, │ ╰─────────────^ expected enum `Result`, found struct `LineIndexOutOfBoundsError` │ = expected type `Result<ByteIndex, LineIndexOutOfBoundsError>` found type `LineIndexOutOfBoundsError` ``` …is now rendered as: ``` error[E0308]: match arms have incompatible types ┌── codespan/src/file.rs:1:9 ─── │ 1 │ ╭ match line_index.compare(self.last_line_index()) { 2 │ │ Ordering::Less => Ok(self.line_starts()[line_index.to_usize()]), │ │ --------------------------------------------- this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>` 3 │ │ Ordering::Equal => Ok(self.source_span().end()), │ │ ---------------------------- this is found to be of type `Result<ByteIndex, LineIndexOutOfBoundsError>` 4 │ │ Ordering::Greater => LineIndexOutOfBoundsError { │ ╭─│──────────────────────────────────^ 5 │ │ │ given: line_index, 6 │ │ │ max: self.last_line_index(), 7 │ │ │ }, │ ╰─│─────────────^ expected enum `Result`, found struct `LineIndexOutOfBoundsError` 8 │ │ } │ ╰─────────' `match` arms have incompatible types │ = expected type `Result<ByteIndex, LineIndexOutOfBoundsError>` found type `LineIndexOutOfBoundsError` ``` Closes #100
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As mentioned in #77, Rustc does a clever job of grouping together labels:
It would be super neat if we could do something similar!
At the moment our diagnostics are all spread out:
It would be great if we could collapse things down, for example:
Or in the case of that rustc error:
It might be worth studying how librustc_errors does this. There's a bunch of clever logic in emitter.rs that it might be worth understanding.
The text was updated successfully, but these errors were encountered: