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

Conversation

jmviz
Copy link
Contributor

@jmviz jmviz commented Feb 19, 2023

This adds the openDocs command to the VS Code context menu. I believe there are probably many user who are unaware of this command existing in the rust analyzer extension, and that this should enhance the discoverability of the command. Additionally, even if people are aware of this capability, it's helpful to have this in the context menu anyway; for example, one might forget the name of the command, or the keybinding they have assigned to it. I think that opening docs is a common enough action to warrant the extra line added to the context menu.

This makes a few other small changes as well. There are two minor style changes to increase style consistency. First, it changes the titles of the two commands that the rust analyzer extension will contribute to the context menu to title case. All standard VS Code commands that appear in the context menu are in title case. Second, it shortens the title of the openDocs command from Open docs under cursor to Open Docs. The implicit assumption in the standard VS Code context menu command titles is that the action applies to the symbol under the cursor: Go to Definition, Find All References, etc. Note that since these are changes to the command titles, rather than the command names themselves, these changes will not break any users' existing keybindings for these commands.

Second, this adds further restrictions to the where clauses of the two commands that the rust analyzer extension will contribute to the context menu, so that the two commands will appear in the context menu only when in a Rust project and within a Rust file. Say you have a Python or bash script inside your Rust project. Having these commands appear in the context menu when you right click a symbol in such a non-Rust file is extraneous and potentially confusing.

demonstration

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 19, 2023
@jmviz jmviz closed this Feb 19, 2023
@jmviz jmviz reopened this Feb 19, 2023
@jmviz jmviz changed the title add openDocs command to context menu add openDocs command to context menu in VS Code extension Feb 19, 2023
Copy link
Member

@HKalbasi HKalbasi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lnicola
Copy link
Member

lnicola commented Feb 24, 2023

Thanks!

@bors r+

changelog feat (first contribution) add "Open Docs" command to the context menu

@bors
Copy link
Contributor

bors commented Feb 24, 2023

📌 Commit dd92e4a has been approved by lnicola

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Feb 24, 2023

⌛ Testing commit dd92e4a with merge f5401f6...

@bors
Copy link
Contributor

bors commented Feb 24, 2023

☀️ Test successful - checks-actions
Approved by: lnicola
Pushing f5401f6 to master...

@bors bors merged commit f5401f6 into rust-lang:master Feb 24, 2023
@jmviz jmviz deleted the openDocs-context-menu branch February 24, 2023 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants