rust-lang / rust-lang/rust-analyzer
The "Self::" paths aren't properly processed in the doc-comments.
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Given this code:
struct A;
/// Bla bla - [`Self::process_messages`].
pub fn new() -> Self {
Self
}
/// Documentation for processing messages.
pub fn process_messages(&self) {}
The Self::process_messages is never a hyperlink and doesn't navigate anywhere, it is not highlighted. But in the generated output of cargo doc (the HTML pages), it is properly highlighted and navigates to the correct place within the code.
If I change the Self to A in this example, everything works, but this is rarely the intention, considering how useful the Self alias is.
Is it possible to solve this in the rust-analyzer?
rust-analyzer version: 0.3.1615-standalone
rustc 1.71.1 (eb26296b5 2023-08-03)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue in rust-analyzer with the shown Rust doc-comment example, comparing Self::process_messages with A::process_messages. Start at rust-analyzer's doc-comment link-resolution entry point and compare the result with the cargo doc HTML behavior. Done means the Self link is highlighted and navigates to process_messages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100