rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
13.98k stars 1.55k forks source link

externalDocs opens wrong url in some cases #16724

Open paul-hansen opened 5 months ago

paul-hansen commented 5 months ago

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

Parsifa1 commented 1 month ago

It seems almost all of marco's opendocs are broken wrong right