-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Make deleted code in a suggestion clearer #86532
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr
Outdated
Show resolved
Hide resolved
I personally view the narrow end of an arrow as a destination to insert some items.
However, I do get the choice of |
Just thinking.. what about making it clearer with underline+overline, to avoid @Nicholas-Baron "insert location" interpretation?
|
Adding to the bikeshed...
Red for deletions Maybe use Maybe even highlight what the user should try to add? |
The code used to be the same color as the highlights below it, but was changed to be the default color at some point. |
That doesn't work without colors. Think about a color blind person or copy pasted error messages. |
I think it works without colors.
|
Oh, the |
The other option is to keep the removed code and give it a red background or color, and a different underline, like was proposed above so that it still works with colorless output:
What we lose with that is the ability to just copy and paste the code from the terminal (although I doubt that's a common occurrence). |
Yeah. On second thought I don't think I would use I think that
I don't like that option personally. I would like the output to show exactly what the code looks like after applying the suggestion. I can compare with the current version of the code in the first error message. |
I think I kind of like There seems to be a suggestion for electronic texts to use marks including Another possibility is to use inline comments like |
That's been my personal take, but I've encountered enough people that have gotten confused by it that it's making me reconsider my stance for the projects sake. The problem I see with using Edit: implemented one of the proposals keeping deletions around (which is buggy, but gives an idea of what it'd look like): |
I'm convinced on that. It looks like diff output but the semantics are different. That's confusing. |
While we’re at it with the red mark, maybe a strikethrough can be tried too? The \e[9 stuff, not the Unicode hack. |
We use termcolor which doesn't have support to specify strikethrough. Using unicode, I have this mockup. Please ignore the obvious bugs with color positions: I don't know if the strikethrough will help that much. |
I think that ANSI terminal strikethrough capability isn't widely supported? Also, I think it's important that any annotations survive copying and pasting, especially because we often ask people to copy and paste full error messages when they ask about compiler errors. |
I agree. Maybe |
I think if we're going to leave the deleted text inline, I'm leaning toward surrounding it with a |
I'm worried that how the first looks like with |
Gcc uses the exact same squiggles for a different purpose:
or
For reference this is what gcc uses for insertions:
and clang:
|
@estebank blessing the Clippy tests with Anyway, here's a gist of the Clippy patch |
📌 Commit 657caa5 has been approved by |
⌛ Testing commit 657caa5 with merge d8036c085d6934bf52caa7b9ab656f95a31c1616... |
💥 Test timed out |
@bors retry |
☀️ Test successful - checks-actions |
Use `multipart_suggestions` more Built on top of rust-lang#86532
Show suggestions that include deletions in a way similar to
diff
's output.For changes that do not have deletions, use
+
as an underline for additions and~
as an underline for replacements.For multiline suggestions, we now use
~
in the gutter to signal replacements and+
to signal whole line replacements/additions.In all cases we now use color to highlight the specific spans and snippets.