From ed1f467aabf03a451355b6e0de8de2f6a2e101ce Mon Sep 17 00:00:00 2001 From: jmviz Date: Fri, 17 Feb 2023 17:41:39 -0500 Subject: [PATCH 1/3] add openDocs to context menu. add further restrictions to context menu when clauses to prevent irrelevant commands in non-rust files --- editors/code/package.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/editors/code/package.json b/editors/code/package.json index 3610e993f8222..b206c15f34c29 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -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" } ] }, From 2351875e6a2e2f30787624002440ea9690b7cc12 Mon Sep 17 00:00:00 2001 From: jmviz Date: Sun, 19 Feb 2023 10:12:44 -0500 Subject: [PATCH 2/3] change titles of commands in context menu to title case. shorten open docs command --- editors/code/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/editors/code/package.json b/editors/code/package.json index b206c15f34c29..243208c4962b5 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -226,7 +226,7 @@ }, { "command": "rust-analyzer.openDocs", - "title": "Open docs under cursor", + "title": "Open Docs", "category": "rust-analyzer" }, { @@ -236,7 +236,7 @@ }, { "command": "rust-analyzer.peekTests", - "title": "Peek related tests", + "title": "Peek Related Tests", "category": "rust-analyzer" }, { From dd92e4a507f2783507f3a37b94c3a80d48def3d3 Mon Sep 17 00:00:00 2001 From: jmviz Date: Mon, 20 Feb 2023 11:38:33 -0500 Subject: [PATCH 3/3] add to manual --- crates/ide/src/doc_links.rs | 13 ++++++++++++- crates/ide/src/runnables.rs | 7 +++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs index b4a7f2b918a46..339bb28180221 100644 --- a/crates/ide/src/doc_links.rs +++ b/crates/ide/src/doc_links.rs @@ -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, diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs index 5b35262aabe11..af53adee898af 100644 --- a/crates/ide/src/runnables.rs +++ b/crates/ide/src/runnables.rs @@ -195,14 +195,13 @@ pub(crate) fn runnables(db: &RootDatabase, file_id: FileId) -> Vec { // // 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,