Skip to content

Clipboard button should copy version for crate, not just the name #106990

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

Open
jyn514 opened this issue Jan 17, 2023 · 6 comments
Open

Clipboard button should copy version for crate, not just the name #106990

jyn514 opened this issue Jan 17, 2023 · 6 comments
Assignees
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Jan 17, 2023

Take https://docs.rs/tokio/1.24.1/tokio/index.html as an example: clicking the clipboard will copy tokio to the clipboard, but ideally it would copy tokio = "1.24.1", like https://docs.rs/crate/tokio/latest does. Rustdoc already has this information because it shows the crate version in the sidebar.

@jyn514 jyn514 added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. labels Jan 17, 2023
@jyn514
Copy link
Member Author

jyn514 commented Jan 17, 2023

Take a look around

window.copy_path = but => {
const parent = but.parentElement;
const path = [];
onEach(parent.childNodes, child => {
if (child.tagName === "A") {
path.push(child.textContent);

@jyn514 jyn514 added E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. and removed E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. labels Jan 17, 2023
@atsuzaki
Copy link
Contributor

@rustbot claim

@GuillaumeGomez
Copy link
Member

Strongly disagree here. The goal here is to provide a button to copy a path to the current item. It doesn't achieve the same goal as having the crate and its version (which makes sense if you're browsing crates.io for example).

@jyn514
Copy link
Member Author

jyn514 commented Jan 17, 2023

@GuillaumeGomez when would it be useful to copy the crate name and nothing else? use tokio; is a no-op.

@GuillaumeGomez
Copy link
Member

But then you introduce incoherence. How could someone know that copying the crate name would result in something different than any other path? I'd prefer to not special-case this any further. If you're not convinced, we can ask the rustdoc team directly too to see what they think about it.

@workingjubilee
Copy link
Member

Honestly, I have never used this functionality and wasn't aware of its existence until I saw this issue open. Given the absolutely huge DOM that we generate, and the render costs thereof, I'm surprised we have such a frill.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants