-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat: vscode: Support opening local documentation if available #15728
Merged
bors
merged 2 commits into
rust-lang:master
from
EliasHolzmann:feature/local_documentation_vscode
Oct 10, 2023
Merged
feat: vscode: Support opening local documentation if available #15728
bors
merged 2 commits into
rust-lang:master
from
EliasHolzmann:feature/local_documentation_vscode
Oct 10, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
According to the VS Code documentation, the vscode.open command opens the URL _in the editor_ (https://code.visualstudio.com/api/references/commands). However, in reality, it seems to do so only for file:// URLs, falling back to other applications for other URL schemes (at least for HTTP/HTTPS). Until now, the URL to the documentation was always HTTP based, so using the vscode.open command was perfectly fine. However, displaying local documentation will be supported from now on (see next commit). Local documentation is not HTTP-based, but instead addressed via a file:// URL. The file URL would therefore be opened in VS Code instead of in the browser — this is definitely not what the user wants. Therefore, the vscode.env.openExternal function is used instead, this function never opens the URL in VS Code.
rustbot
added
the
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
label
Oct 8, 2023
Veykril
reviewed
Oct 9, 2023
Veykril
added
S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Oct 9, 2023
Veykril
reviewed
Oct 9, 2023
EliasHolzmann
force-pushed
the
feature/local_documentation_vscode
branch
from
October 9, 2023 18:06
4a1c657
to
3ff80e0
Compare
Displaying local instead of web docs can have many benefits: - the web version may have different features enabled than locally selected - the standard library may be a different version than is available online - the user may not be online and therefore cannot access the web documentation - the documentation may not be available online at all, for example because it is for a new feature in a library the user is currently developing If the documentation is not available locally, the extension still falls back to the web version.
EliasHolzmann
force-pushed
the
feature/local_documentation_vscode
branch
from
October 9, 2023 18:12
3ff80e0
to
e8372e0
Compare
Veykril
approved these changes
Oct 10, 2023
Thanks! |
☀️ Test successful - checks-actions |
Sorry if it shouldn't be asked here, a quick google didn't yield me much, but how do you get local docs? Is it for all crates or just stdlib? I could see doing away with doc viewers like Dash completely if this is broadly available. |
|
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements the VS code support for opening local documentation (server side support was already implemented in #14662).
local_docs.webm
Displaying local instead of web docs can have many benefits:
If the documentation is not available locally, the extension still falls back to the web version.
Closes #12867.
If my implementation isn't really idiomatic TypeScript: Sorry, I'm not much of a TypeScript developer. I am open to feedback, however.