-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 code on diagnostics when underlined #45752
Conversation
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
Don't merge yet, needs a quick code change yet. |
@estebank I'm trying to remember why we stopped highlighting the code examples with color, but I cannot. In any case, the examples where there are overlapping spans look...odd to my eye. I wish we had a more elegant way of handling that. I feel like I would prefer if the underlines were drawn on different lines. This is to some extent a distinct issue, but the color makes it more noticeable to me. =) |
What's with the random blue highlighting in some examples? In the first one, |
@durka because of a mistake I made, it's inserting style at position instead of actually replacing, making the output of overlapping spans incorrect, as you see in that screenshot. I didn't notice it until I published the PR :)
Neither can I :-/
As for the weirdness around overlapping spans, I feel that 1) it'd get sidestepped by highlighting with bold only (it'd just point towards region without carrying any info about the span type, that'd be only in the underline, so we end up in the same place as today), and 2) even beyond the weirdness of having differently colored code and underline is that it is one way of actually carrying information on where at least one of the spans actually starts without having multiple lines dedicated to the overlapping underlines, but it does look slightly weird. Even if we make the overlapping underlines appear in different lines we're back to really ugly output for thin terminals seen in #42112. |
02df37f
to
fb8345b
Compare
Alternative PR #45776 that doesn't use color, only highlights both primary and secondary spans. |
Moving this to r? @nikomatsakis so that he's the reviewer for both alternative PRs. |
I think there is general consensus that if we were to do anything, it would be #45776, right? Maybe we can close this one? |
Closing. |
Based on our recent conversation, maybe this is still on the table? |
@nikomatsakis yes, let's keep it around. |
@carols10cents, I think @nikomatsakis and I lean towards merging this one, but I'd like to get some support to disable it in some way before doing so. |
Sounds like @estebank has some more work to do before we'd be happy merging, yeah? |
@estebank I say let's do it. We can always back off. |
Well, I guess I agree with the idea that we should make it configurable. The time has come, I guess. |
@estebank ping from triage — will you have some time to make this configurable? |
@shepmaster I will try to have something before the end of the year. |
@nikomatsakis I started playing with using You can take a look at the code (broken at the moment) if you want to see the general approach I took. |
cc @alexcrichton @eddyb @rust-lang/compiler -- seems ok to me in principle. I'm not sure if there are technical complications. |
fb8345b
to
4f1148f
Compare
@nikomatsakis, rebased and gated it on |
4f1148f
to
cd01246
Compare
cd01246
to
08287c1
Compare
good enough for now! @bors r+ |
📌 Commit 08287c1 has been approved by |
⌛ Testing commit 08287c1 with merge 9712a3319ba284f218145d17a162b150d896623d... |
💔 Test failed - status-appveyor |
@bors retry 3 hour timeout on |
⌛ Testing commit 08287c1 with merge 8ffa119abdc6290be864cad373cd4f7c1a16f76e... |
💔 Test failed - status-appveyor |
⌛ Testing commit 08287c1 with merge ee8dbd216863f3715fbf98ccaf089afa713ae737... |
💔 Test failed - status-appveyor |
I'll try one more time @bors retry |
Highlight code on diagnostics when underlined Highlight the label's span with the respective color: <img width="692" alt="" src="https://user-images.githubusercontent.com/1606434/32411026-a1842482-c18d-11e7-9933-6510eefbad19.png"> Fix #42112.
☀️ Test successful - status-appveyor, status-travis |
Highlight the label's span with the respective color:
Fix #42112.