rust-lang / rust-lang/rust-analyzer

externalDocs opens wrong url in some cases

Open
#16,724 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

rust-analyzer version: 1.76.0 (07dca48 2024-02-04)

rustc version: 1.76.0 (07dca489a 2024-02-04)

repository link:
https://github.com/arlyon/async-stripe
https://github.com/lettre/lettre

code snippet to reproduce:

use stripe::CheckoutSession;

pub fn main() {
   // Just using it with typeid so the compiler is happy without having to construct the type.
   std::any::TypeId::of::<CheckoutSession>();
}

If you call the "experimental/externalDocs" LSP command ("rust-analyzer: Open Docs" pallete command in VsCode) while your cursor is over CheckoutSession in the example code it will open the wrong url.

Currently opens:
https://docs.rs/async-stripe/stripe/resources/generated/checkout/checkout_session/struct.CheckoutSession.html
Should open :
https://docs.rs/async-stripe/0.34.1/stripe/struct.CheckoutSession.html

This happens with most symbols in the async-stripe crate, likely related to how it generates it's code from an openapi spec.

This also happens with some symbols in the lettre crate
Currently opens:
https://docs.rs/crate/lettre/0.11.4/lettre/transport/file/struct.AsyncFileTransport.html
Should open:
https://docs.rs/lettre/latest/lettre/transport/smtp/struct.AsyncSmtpTransport.html

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 with the experimental/externalDocs LSP command exposed by the “rust-analyzer: Open Docs” VSCode command and reproduce the issue using the async-stripe and lettre snippets. Trace how symbol documentation URLs are selected, then verify that CheckoutSession and AsyncSmtpTransport open the expected docs.rs URLs rather than generated-module paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, vscode
Domain
developer-experience, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.