rust/editors/code/src
bors[bot] fb2534f300 Merge #1459
1459: Include primary span label in VS Code diagnostics r=matklad a=etaoins

In most cases the primary label span repeats information found elsewhere in the diagnostic. For example, with E0061:

```json
{
  "message": "this function takes 2 parameters but 3 parameters were supplied",
  "spans": [{"label": "expected 2 parameters"}]
}
```

However, with some mismatched type errors (E0308) the expected type only appears in the primary span's label, e.g.:

```json
{
  "message": "mismatched types",
  "spans": [{"label": "expected usize, found u32"}]
}
```

I initially added the primary span label to the message unconditionally. However, for most error types the child diagnostics repeat the primary span label with more detail. `rustc` also renders the duplicate text but because the span label and child diagnostics appear in visually distinct places it's not as confusing.

This takes a heuristic approach where it will only add the primary span label if there are no child message lines. For most error types the child messages repeat the primary span label with more detail.

Co-authored-by: Ryan Cumming <etaoins@gmail.com>
2019-06-30 09:54:47 +00:00
..
commands Fix cargo watch code action filtering 2019-06-29 17:39:36 +10:00
events Allow syntax tree to update when changing files 2019-03-03 22:03:37 +02:00
notifications Run prettier on all files 2018-10-08 22:38:33 +01:00
test Include primary span label in VS Code diagnostics 2019-06-30 11:12:56 +10:00
utils Merge #1459 2019-06-30 09:54:47 +00:00
config.ts Add noUnusedLocals to VsCode tsconfig 2019-06-29 18:00:22 +10:00
extension.ts switch to official extend selection API 2019-04-21 12:13:48 +03:00
highlighting.ts Make rainbows optional 2019-05-27 11:44:46 +02:00
server.ts make LRU cache configurable 2019-06-12 13:36:24 +03:00