Skip to content

add openDocs command to context menu in VS Code extension #14175

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

Merged
merged 3 commits into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion crates/ide/src/doc_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,18 @@ pub(crate) fn remove_links(markdown: &str) -> String {
out
}

/// Retrieve a link to documentation for the given symbol.
// Feature: Open Docs
//
// Retrieve a link to documentation for the given symbol.
//
// The simplest way to use this feature is via the context menu. Right-click on
// the selected item. The context menu opens. Select **Open Docs**.
//
// |===
// | Editor | Action Name
//
// | VS Code | **rust-analyzer: Open Docs**
// |===
pub(crate) fn external_docs(
db: &RootDatabase,
position: &FilePosition,
Expand Down
7 changes: 3 additions & 4 deletions crates/ide/src/runnables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,13 @@ pub(crate) fn runnables(db: &RootDatabase, file_id: FileId) -> Vec<Runnable> {
//
// Provides a sneak peek of all tests where the current item is used.
//
// The simplest way to use this feature is via the context menu:
// - Right-click on the selected item. The context menu opens.
// - Select **Peek related tests**
// The simplest way to use this feature is via the context menu. Right-click on
// the selected item. The context menu opens. Select **Peek Related Tests**.
//
// |===
// | Editor | Action Name
//
// | VS Code | **rust-analyzer: Peek related tests**
// | VS Code | **rust-analyzer: Peek Related Tests**
// |===
pub(crate) fn related_tests(
db: &RootDatabase,
Expand Down
11 changes: 8 additions & 3 deletions editors/code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@
},
{
"command": "rust-analyzer.openDocs",
"title": "Open docs under cursor",
"title": "Open Docs",
"category": "rust-analyzer"
},
{
Expand All @@ -236,7 +236,7 @@
},
{
"command": "rust-analyzer.peekTests",
"title": "Peek related tests",
"title": "Peek Related Tests",
"category": "rust-analyzer"
},
{
Expand Down Expand Up @@ -1869,8 +1869,13 @@
"editor/context": [
{
"command": "rust-analyzer.peekTests",
"when": "inRustProject",
"when": "inRustProject && editorTextFocus && editorLangId == rust",
"group": "navigation@1000"
},
{
"command": "rust-analyzer.openDocs",
"when": "inRustProject && editorTextFocus && editorLangId == rust",
"group": "navigation@1001"
}
]
},
Expand Down