Skip to content

Autocomplete cargo doc paths/links to types in doc comment #4759

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
chinedufn opened this issue Jun 5, 2020 · 3 comments
Open

Autocomplete cargo doc paths/links to types in doc comment #4759

chinedufn opened this issue Jun 5, 2020 · 3 comments
Labels
A-completion autocompletion E-hard S-actionable Someone could pick this issue up and work on it right now

Comments

@chinedufn
Copy link
Contributor

I've opened this same issue in intellij-rust, but figured I'd also open it here since I'm interested in both tools.

Here's the copy pasted issue:


If you write something like the following in a doc comment

/// An error returned by [`RefCell::try_borrow`](struct.RefCell.html#method.try_borrow).
#[stable(feature = "try_borrow", since = "1.13.0")]
pub struct BorrowError {
    _private: (),
}

The struct.RefCell.html#method.try_borrow your documentation site will link to the try_borrow method when you click on the RefCell::try_borrow link.

Since the naming convention for pages / links within a cargo doc generated site is consistent - could intellij-rust support autocomplete for these links?

This would make it much easier to write documentation that references other types/methods within your library.

Thanks!

@bjorn3
Copy link
Member

bjorn3 commented Jun 5, 2020

rust-lang/rfcs#1946 specifies how to link to types and methods without specifying a url. eg /// [`RefCell::try_borrow`]

@chinedufn
Copy link
Contributor Author

chinedufn commented Jun 5, 2020

@bjorn3 thanks! I can't quite tell what aspect of this you're commenting on? It seems like you're saying that you don't need to add the (struct.RefCell.html#method_try_borrow) bit?

If so I'd still appreciate auto-complete of the types/methods and the ability to auto-import other types in my crate (not just stdlib).

But perhaps I'm misunderstanding you?

@bjorn3
Copy link
Member

bjorn3 commented Jun 5, 2020

It seems like you're saying that you don't need to add the (struct.RefCell.html#method_try_borrow) bit?

Yes

If so I'd still appreciate auto-complete of the types/methods and the ability to auto-import other types in my crate (not just stdlib).

That would be useful.

@matklad matklad added the E-hard label Jul 11, 2020
@lnicola lnicola added A-completion autocompletion S-actionable Someone could pick this issue up and work on it right now labels Jan 22, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-completion autocompletion E-hard S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

No branches or pull requests

4 participants