rust-lang / rust-lang/rust-analyzer

`externalDocs` doesn't open local docs on WSL

Open
#23,057 0 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

Every time I try to open external docs on WSL, if the locally built docs are available, nothing happens. It's been like this for quite a while.

rust-analyzer version: rust-analyzer version: 0.3.2997-standalone [/home/m/.vscode-server/extensions/rust-lang.rust-analyzer-0.3.2997-linux-x64/server/rust-analyzer]

rustc version: rustc 1.97.1 (8bab26f4f 2026-07-14)

editor or extension: VSCode

code snippet to reproduce: Open a WSL project and try to open external docs for something from the standard library and for something else

/// A struct
struct Foo;

fn main() -> anyhow::Result<()> {
    let _a: i32 = 0;
    let _foo = Foo;

    Ok(())
}

LSP logs for i32:
(Please notice that the web link is for nightly, not stable)

Received response 'experimental/externalDocs - (466)' in 0ms.
Result: {
    "web": "https://doc.rust-lang.org/nightly/core/primitive.i32.html",
    "local": "file:///home/m/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/share/doc/rust/html/core/primitive.i32.html"
}

LSP logs for Foo:

Received response 'experimental/externalDocs - (468)' in 0ms.
Result: {
    "web": "https://docs.rs/stuff/0.1.0/stuff/struct.Foo.html",
    "local": "file:///home/m/source/other/stuff/target/doc/stuff/struct.Foo.html"
}

LSP logs for anyhow::Result:

Received response 'experimental/externalDocs - (470)' in 1ms.
Result: {
    "web": "https://docs.rs/anyhow/1.0.104/anyhow/type.Result.html",
    "local": "file:///home/m/source/other/stuff/target/doc/anyhow/type.Result.html"
}

The docs for i32 don't open at all. The docs for anyhow::Result and Foo open in my default browser, but after running cargo doc it tries to open the "local" version, and nothing happens. Links like file://///wsl.localhost/Debian/home/m/source/stuff/target/doc/stuff/struct.Foo.html or file://///wsl.localhost/Debian/home/m/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/share/doc/rust/html/core/primitive.i32.html do open in my browser as they should.

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 at the experimental/externalDocs entry point and reproduce the issue in a WSL project through VSCode. Compare how the returned local file:// URI is passed to the browser with the working \wsl.localhost form. Done means locally built standard-library and crate documentation opens correctly, while the web fallback remains available.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.