-
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
Tracking issue for #[doc(spotlight)]
#45040
Comments
Couple of observations:
|
I think it'd be handy to write up guidelines for when spotlight should be added to a trait. I had to search pretty deep through the history of this feature until I found out what the original use-case was. There's also another question of why this is a whitelist instead of a blacklist? Aren't trait implementations usually important, except those that are extremely common (like |
The '🛈' sign being to the left of the function signature was confusing to me. I expected it to provide extra information about the function but it's actually related to the return type My intuition is that the spotlight feature should really be just a simple balloon (tooltip) that shows up when hovering over '🛈' or Maybe we don't even need the '🛈' sign - maybe it's enough to just show the balloon when hovering over the type. Also, clicking on '🛈' is a bit cumbersome - it feels like too much UI interaction for a quick peek into the return type. Finally, I'd probably prefer the balloon showing up when hovering over any occurence of the type |
FWIW I don't like the mouseover effect. It's surprising when I trigger it unintentionally, making things worse by covering the function signature I was trying to read. And I agree it should be somehow visually associated with the return type, instead of the current confusing location. |
@jonhoo The reason it was a whitelist was because i originally wanted this feature to be for "fundamental" traits, those that can effectively define an entire type. Things that implement However, putting every trait on there would blow out the window and possibly make it even worse than not having it there in the first place. Note that the idea came from #25928, and the fact that i wrote a generalized solution was mainly for @jethrogb Oh wow, i didn't even notice that I initially wanted the circle-i icon to be next to the return type as well, but when @GuillaumeGomez put this UI together he said that we couldn't guarantee them appearing next to each other, in situations like line-wrapping and the like. There may have been issues getting everything together for the print as well. I wonder how much of a problem it would be to try to stick them next to each other. |
@QuietMisdreavus ah, I see. I wonder if the name Anyway, that's a lot of bikeshedding. I do think picking a more semantic name will lead to much less confusion for users though! |
Maybe put a box around the return type or something? The current design
strongly suggests something is special about the function itself, which is
misleading.
…On Fri, Jan 12, 2018 at 4:25 PM, Jon Gjengset ***@***.***> wrote:
@QuietMisdreavus <https://github.com/quietmisdreavus> ah, I see. I wonder
if the name spotlight should be changed to better hint at that being the
target use-case, rather than just "show this as special". Essentially, the
name should communicate the semantic implications, more so than the desired
visual outcome. It's too verbose, but something along the lines of
#[doc(is_likely_primary_impl)]. Maybe #[doc(fundamental)] or
#[doc(dominant)]? #[doc(notable)] also isn't terrible, but loses the
"this is likely the primary behavior of implementors. An argument *could*
also be made for #[doc(essential)], in that these traits are likely the
*essence* of any implementing type, but unfortunately "essential" also
carries may other connotations (along these lines, "constitutive" is great,
but too obscure, and "intrinsic" is already used elsewhere).
Anyway, that's a lot of bikeshedding. I do think picking a more semantic
name will lead to much less confusion for users though!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#45040 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAC3n87eb4793wKRoq8BKLMoZYQhTQwuks5tJ83SgaJpZM4Pugq7>
.
|
I like |
Maybe we should open a survey to pick a name? |
I don't think renaming the feature should be too problematic. It's a nightly unstable feature for a reason! @GuillaumeGomez I don't think it's outrageous to spend some time getting this name right before stabilization. I do agree with your sentiment that we shouldn't lament too much over this decision, but |
Yes, that's why I suggested to open a survey. I don't have any personal preference on this topic and I have the feeling that's the case for everyone. So unless someone has a proposition, let's just open a survey or something along the lines. :) |
@GuillaumeGomez ah, sorry, I thought you were being sarcastic! A survey seems a bit like overkill to me, but I'm not really opposed to it. How/where do you propose we do the survey? |
No, I was serious haha. And no idea. Either we open an issue where we put a few names and then people comment on it or we use a survey on a website and see what comes out. Once again, no preference at all on my side. |
Is it planned, that functions, which returns |
@QuietMisdreavus wrote:
Couldn't you use a |
It seems to me that it would be more obvious and flexible if the relationship went the other way: by tagging the
|
I was looking at the rustdocs the other day and I ended up re-inventing this attribute (I assumed rust-doc just had a hard coded list). The version I came up with allowed the attribute to be in two different locations. #[doc(notable)]
pub trait Iterator {}
#[doc(notable)]
impl Write for File {} This solves two problems. First, it allows the original behaviour with how Iterators/Futures are always notable. And it solves another issue where There's one more problem that I found which I'm not sure how to address just yet - In my opinion, |
A few more ideas:
We could somehow use the Another point I wanted to make when I initially had my idea was that the documentation on the specific type's page does not indicate it's notable traits: Instead, relying on the doc comments to point the user to the right place. This is fine but I feel like the hint would also be useful here if the reader found their way to this page. Perhaps as well, we could use the foundations we have laid down from our |
Initially implemented in #45039, this attribute puts your own trait on every function doc if its return type implements it.
The text was updated successfully, but these errors were encountered: