-
Notifications
You must be signed in to change notification settings - Fork 60
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
Highlight text pointed to by labels #206
Comments
Relevant PR: #168 |
Maybe #100 and highlighting text could be made mutually exclusive? That would look a little odd visually anyway. |
Yeah, I'm currently in the process of trying to implement #100, and the highlighted code sections were rather hard to deal with - ie. you need to figure out which to prioiritise (perhaps primary spans?). As an aside I've also noticed that the diagnostics begin to look super over-bearing when multiline source code is highlighted in colour. |
Had another look at this today. This is the relevant part of the code that we'd need to change: codespan/codespan-reporting/src/term/renderer.rs Lines 268 to 270 in d418193
Sketching it out, it might look something like this: // Write source text
write!(self, " ")?;
for (byte_index, ch) in source.char_indices() {
// TODO: Check if in primary multi-line label
// TODO: Check if in primary single-line label
// TODO: Do tab-stop calculation here, rather than using `self.config.source(self.writer)`
write!(self, "{}", ch)?;
}
// TODO: undo styling if necessary
write!(self, "\n")?; I'm thinking we'd only highlight primary labels. |
I noticed that codespan-reporting 0.9 is no longer highlighting the file characters pointed to by labels. For my use case I think I found that the highlighted way was preferable. Is this something that you would be open to bringing back as an option?
codespan-reporting 0.8.0:
codespan-reporting 0.9.0:
The text was updated successfully, but these errors were encountered: