-
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
Improve error messages for intra-doc links when there are backticks #87169
Comments
You can fix this by using a
It'll take more vertical space, but it's ok. If someone picks this up as their first contribution, you need to |
@rustbot claim |
@estebank It's a bit different here because we create the spans ourselves because they come from inside a doc comment. So I'm not sure if your suggestion will work out. Also, in here it's |
@GuillaumeGomez thanks for the correction! As long as the span was synthesized correctly (including what side of a char the boundary falls on), then just changing the method will work as expected. |
I had in mind to simply update the span instead in case the string was starting and ending with backticks. |
@GuillaumeGomez look at the code that's already there: rust/src/librustdoc/passes/collect_intra_doc_links.rs Lines 2104 to 2108 in c49895d
If you think this shouldn't use verbose , remove that instead. But I think it's better to show backticks if the user had them there originally.
|
We can take advantage of the span to exclude the backticks from the underlining, so then we can avoid displaying the backticks twice in the suggestion. As for the how, I guess it's fine as long as we get the output we want. |
…tebank Improve intra doc errors display rust-lang#87169 `@jyn514` This is what I had in mind to avoid having duplicated backticks. I also gave a try to simply updating the span for the suggestion/help messages but I think this current one is better because less "noisy". Anyway, that allows you to see the result. ;)
…tebank Improve intra doc errors display rust-lang#87169 ``@jyn514`` This is what I had in mind to avoid having duplicated backticks. I also gave a try to simply updating the span for the suggestion/help messages but I think this current one is better because less "noisy". Anyway, that allows you to see the result. ;)
…bank Improve intra doc errors display rust-lang#87169 `@jyn514` This is what I had in mind to avoid having duplicated backticks. I also gave a try to simply updating the span for the suggestion/help messages but I think this current one is better because less "noisy". Anyway, that allows you to see the result. ;)
Fixed in #87285. |
In #87078, we arrived at the following situation:
I want to underline this part in particular:
Having two backticks is very weird. What I suggest instead is to reduce the "^^^^^" underlining part in order to not include backticks in it so then they can be removed from the error message as well, which would give:
I'll do it in the next days if no one does until then. :)
cc @jyn514
The text was updated successfully, but these errors were encountered: