]> git.lizzy.rs Git - rust.git/commit
Merge #1439
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>
Tue, 25 Jun 2019 12:37:07 +0000 (12:37 +0000)
committerbors[bot] <26634292+bors[bot]@users.noreply.github.com>
Tue, 25 Jun 2019 12:37:07 +0000 (12:37 +0000)
commit4b0c37bd6e4cb3d47614ec6b42fb1deef9bc9324
tree31ac3e97ade900dd51bc39c007316aa20a2e85fc
parentba97a5fbd2e14f38c633948f0d1551d0cf086ca3
parent5c6ab1145319414e897a8eaca2bf1ad5558ccf24
Merge #1439

1439: Rich mapping of cargo watch output r=matklad a=etaoins

Currently we depend on the ASCII rendering string that `rustc` provides to populate Visual Studio Code's diagnostic. This has a number of shortcomings:

1. It's not a very good use of space in the error list
2. We can't jump to secondary spans (e.g. where a called function is defined)
3. We can't use Code Actions aka Quick Fix

This moves all of the low-level parsing and mapping to a `rust_diagnostics.ts`. This uses some heuristics to map Rust diagnostics to VsCode:

1. As before, the Rust diagnostic message and primary span is used for the root diagnostic. However, we now just use the message instead of the rendered version.

2. Every secondary span is converted to "related information". This  shows as child in the error list and can be jumped to.

3. Every child diagnostic is categorised in to three buckets:
    1. If they have no span they're treated as another line of the root messages
    2. If they have replacement text they're treated as a Code Action
    3. If they have a span but no replacement text they're treated as related information (same as secondary spans).

Co-authored-by: Ryan Cumming <etaoins@gmail.com>