Use correct toolchain channel when generating builtin type doc links
This commit is contained in:
parent
ac2708a347
commit
616fdd04bb
@ -487,19 +487,23 @@ fn get_doc_base_urls(
|
||||
let system_doc = sysroot
|
||||
.map(|sysroot| format!("file:///{sysroot}/share/doc/rust/html/"))
|
||||
.and_then(|it| Url::parse(&it).ok());
|
||||
let krate = def.krate(db);
|
||||
let channel = krate
|
||||
.and_then(|krate| db.toolchain_channel(krate.into()))
|
||||
.unwrap_or(ReleaseChannel::Nightly)
|
||||
.as_str();
|
||||
|
||||
// special case base url of `BuiltinType` to core
|
||||
// https://github.com/rust-lang/rust-analyzer/issues/12250
|
||||
if let Definition::BuiltinType(..) = def {
|
||||
let web_link = Url::parse("https://doc.rust-lang.org/nightly/core/").ok();
|
||||
let web_link = Url::parse(&format!("https://doc.rust-lang.org/{channel}/core/")).ok();
|
||||
let system_link = system_doc.and_then(|it| it.join("core/").ok());
|
||||
return (web_link, system_link);
|
||||
};
|
||||
|
||||
let Some(krate) = def.krate(db) else { return Default::default() };
|
||||
let Some(krate) = krate else { return Default::default() };
|
||||
let Some(display_name) = krate.display_name(db) else { return Default::default() };
|
||||
let crate_data = &db.crate_graph()[krate.into()];
|
||||
let channel = db.toolchain_channel(krate.into()).unwrap_or(ReleaseChannel::Nightly).as_str();
|
||||
|
||||
let (web_base, local_base) = match &crate_data.origin {
|
||||
// std and co do not specify `html_root_url` any longer so we gotta handwrite this ourself.
|
||||
|
Loading…
x
Reference in New Issue
Block a user