Skip to content
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: enable localDocs #1261

Merged
merged 1 commit into from
Aug 6, 2024
Merged

Conversation

danielrainer
Copy link
Contributor

Opening docs (rust-analyzer.openDocs) was broken by commit 1410329. This commit contains changes preparing for the rust-analyzer "localDocs" feature https://github.com/rust-lang/rust-analyzer/blob/master/docs/dev/lsp-extensions.md#local-documentation However, this feature is only activated by specifying the "localDocs" capability. This commits does so in src/client.ts.

To actually make use of the local documentation, the src/commands.ts:openDocs function also needs adjustment. I wrote it such that if a local URI is provided and a corresponding file exists, it is opened.
Otherwise, if a web link is provided, this link is opened.

Note that "vscode.open" would open the local URI in the editor instead of the browser.

Whether local documentation exists depends on whether 'cargo doc' has been executed. If it has been executed but not recently, the documentation might be outdated, so it might be reasonable to generate local documentation before trying to open it.
This is not done so far, but could be added.
It might make sense to run 'cargo doc --no-deps'.

Opening docs (rust-analyzer.openDocs) was broken by commit
1410329. This commit contains changes
preparing for the rust-analyzer "localDocs" feature
https://github.com/rust-lang/rust-analyzer/blob/master/docs/dev/lsp-extensions.md#local-documentation
However, this feature is only activated by specifying the "localDocs"
capability. This commits does so in src/client.ts.

To actually make use of the local documentation, the
src/commands.ts:openDocs function also needs adjustment.
I wrote it such that if a local URI is provided and a corresponding file
exists, it is opened.
Otherwise, if a web link is provided, this link is opened.

Note that "vscode.open" would open the local URI in the editor instead
of the browser.

Whether local documentation exists depends on whether 'cargo doc' has
been executed. If it has been executed but not recently, the
documentation might be outdated, so it might be reasonable to generate
local documentation before trying to open it.
This is not done so far, but could be added.
It might make sense to run 'cargo doc --no-deps'.
@fannheyward fannheyward merged commit 71921db into fannheyward:master Aug 6, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants