Skip to content

Add support for children in Diagnostic object for complex errors #10271

@trixnz

Description

@trixnz

While working with languages like Rust with rich information in its errors, it's become apparent that not all of this information can be conveyed cleanly with the current Problems window. Take, for example, this error:

warning: this `if` has the same condition as a previous if, #[warn(ifs_same_cond)] on by default
 --> src\main.rs:6:15
  |
6 |     } else if a == b {
  |               ^^^^^^
  |
note: same as this
 --> src\main.rs:4:8
  |
4 |     if a == b {
  |        ^^^^^^
  = help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#ifs_same_cond

The note referencing where the first condition was used would be helpful to the user, but we must omit it because the error list is sorted on the Range of the error, resulting in the note being sorted before the actual error:
2016-08-07_15-09-58
While the above example doesn't look too ambiguous, when there are several errors spread out through the window, it quickly becomes extremely difficult to figure out what relates to each other.

If Diagnostic had a children: Diagnostic[] field where we could add additional context around the error, we would be able to convey more information to the user about the events that led to the error/warning.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions