-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Open docs for symbol should support locally built documentation #12867
Comments
Should it generate latest docs if they are not up to date? |
That's a good question. Would there be any drawbacks to that behavior? |
bors
added a commit
that referenced
this issue
May 2, 2023
…ead_of_docs_dot_rs, r=Ddystopia Provide links to locally built documentation for `experimental/externalDocs` This pull request addresses issue #12867, which requested the ability to provide links to locally built documentation when using the "Open docs for symbol" feature. Previously, rust-analyzer always used docs.rs for this purpose. With these changes, the feature will provide both web (docs.rs) and local documentation links without verifying their existence. Changes in this PR: - Added support for local documentation links alongside web documentation links. - Added `target_dir` path argument for external_docs and other related methods. - Added `sysroot` argument for external_docs. - Added `target_directory` path to `CargoWorkspace`. API Changes: - Added an experimental client capability `{ "localDocs": boolean }`. If this capability is set, the `Open External Documentation` request returned from the server will include both web and local documentation links in the `ExternalDocsResponse` object. Here's the `ExternalDocsResponse` interface: ```typescript interface ExternalDocsResponse { web?: string; local?: string; } ``` By providing links to both web-based and locally built documentation, this update improves the developer experience for those using different versions of crates, git dependencies, or local crates not available on docs.rs. Rust-analyzer will now provide both web (docs.rs) and local documentation links, leaving it to the client to open the desired link. Please note that this update does not perform any checks to ensure the validity of the provided links.
Reopening because #14662 didn't add the client support for Code. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rust-analyzer has a feature to open the docs for the symbol under the cursor, but it always uses docs.rs.
One could be using different versions of crates that aren't on docs.rs, like git dependencies, and also your local crate(s) aren't on docs.rs either.
Open docs should do a best-effort detection of locally built documentation (usually $TARGET_DIR/doc), and open that if the symbol is available under that, before falling back to docs.rs.
The text was updated successfully, but these errors were encountered: