rust-lang / rust-lang/rust-analyzer

Disambiguators are stripped off intra-doc link titles

Open
#16,876 16 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-doc-comments C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

rust-analyzer version: 0.3.1877-standalone (574e23ec5 2024-03-09)
rustc version: rustc 1.76.0 (07dca489a 2024-02-04)
relevant settings: Irrelevant to the issue.
repository link: luau-parser. Irrelevant to the issue.

code snippet to reproduce:

// This is an overly simplified version of it.

/// Some [function parameter](FunctionParameter)
pub struct FunctionParameter {}

Hover over FunctionParameters and read the doc comments, it displays:

image

The (reserved) keyword function is gone. I thought it was maybe because of the text being the same as that of the struct it's linking to, so for the sake of making sure, I tried another keyword:

/// Some [enum parameter](FunctionParameters)
pub struct FunctionParameters {}

And it gives exactly the same result. The word enum vanishes.

Some notes:

  • The issue exists for inner doc comments too (//!).
  • This is case sensitive; using Function or Enum makes it visible.
  • This seems to work when having a different character there, for example function/parameter.
  • It seems to work just fine with keywords like for and in, which means this may have been an intentional thing.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue in rust-analyzer with the provided FunctionParameter and FunctionParameters Rust doc-comment examples, checking both outer and inner comments. Trace how intra-doc link titles are rendered on hover, and consider the issue done when reserved-word disambiguators such as function and enum remain visible while existing link behavior is preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.