wycats / language-reporting

13 stars 3 forks source link

Show primary spans and secondary spans on the same snippet #5

Open sophiajt opened 5 years ago

sophiajt commented 5 years ago

Recently, I tried adding a primary span and a secondary span to an error message. The result is good, but I was wondering if we could take the rustc approach and combine the two into a single labeled snippet.

eg) Instead of:

error: Expected a string from pipeline
- shell:1:50
1 | ls | where size > 1kb | where type != Directory | size
  |                                                   ^^^^ requires string input
- shell:1:0
1 | ls | where size > 1kb | where type != Directory | size
  | -- value originates from here

you could have:

error: Expected a string from pipeline
- shell:1:50
1 | ls | where size > 1kb | where type != Directory | size
  | --                                                ^^^^ requires string input
  | |  
  | value originates from here
zbraniecki commented 5 years ago

It would be great to unify this into https://github.com/rust-lang/annotate-snippets-rs