-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Allow extensions to override command title and/or icon in menu placement (in package.json) #34048
Comments
FYI, the example provided above is very simplistic, but this is a real world problem for me with GitLens and others. Changing the title/icon based on a condition would allow for drastically reduced complexity for extension authors and better usability for users through better contextual titles/icons. To achieve this effect today, you need to create duplicate commands for all the possible usages where the title or icon should change. In GitLens I take that approach in some cases, but in others the extra complexity is just too high to pay the price of all the duplication. |
This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider. If you wonder what we are up to, please see our roadmap and issue reporting guidelines. Thanks for your understanding and happy coding! |
😢 I really wish this (or something similar) can be reconsidered. I really find dealing with commands with many different contexts very difficult to deal with and leads to so much duplication in the |
@jrieken Any chance we can revisit this? I still would find it valuable to be able to at least change the title of a command in its placement. |
👎 this is still against the design of the commands and how we utilise them. And you still didn't answer the question why it should be called "Save" in the global menu and "Delete" in the context menu. |
I think I'm in the right place... I'd also like something like this so I could contribute several numbered commands to the context menu based on settings for Tyriar/vscode-windows-terminal#5 For example:
With context contributions: "menus": {
"explorer/context": [
{
"command": "vscode-windows-terminal.customMenuItem1",
"when": "config.windowsTerminal.customMenuItem1.enabled",
"title": "Open in Windows Terminal (${config.windowsTerminal.customMenuItem1.profile})"
}
{
"command": "vscode-windows-terminal.customMenuItem2",
"when": "config.windowsTerminal.customMenuItem2.enabled",
"title": "Open in Windows Terminal (${config.windowsTerminal.customMenuItem2.profile})"
}
]
} Without something like this I think I need to either just stick with numbers to differentiate them in the context menu which are not user friendly, or enumerate every common possibility and uncommon titles just miss out. |
Allowing dynamic titles in this way (from context key values) would be awesome -- GitLens has the same issue when dealing with opening things (commits, files, branches, repos, etc) on a remote (GitHub, Bitbucket, etc). Right now I use |
@eamodio would GitLens be able to fill in GitHub, Bitbucket, etc. using something before activation? |
No, but we already are already evaluating whether or not to show the menu based on those context keys. |
we need this "commands": [
{
"command": "gitlens.stashSave",
"title": "Stash All Changes", //long name
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-stash.svg",
"light": "images/light/icon-stash.svg"
}
}
],
"menus": {
"commandPalette": [
{
"command": "gitlens.stashSave",
"when": "gitlens:enabled",
"icon": {
"dark": "images/dark/icon-stash-all.svg",
"light": "images/light/icon-stash-all.svg"
}
}
],
"view/item/context": [
{
"command": "gitlens.stashSave",
"when": "gitlens:enabled",
"title": "Stash" //it's a button, short name
}
],
}
|
We have no plans for placement specific titles or icons. All information that is needed to present a command must be on the command itself. If it would be on the menu, that information is locked-in, needs to be potentially duplicated per placement, and is a show-stopper for customizable menus. This doesn't mean that there is no need for a short name and long name but it must be on the command, not the menu. With that menu implements decide what property to use, e.g already today the command palette menu uses the title and category property whereas other menus only use the title property. In fact, internally we added support for |
It would be very helpful (and powerful) if there was the ability to override a command's
title
and/oricon
when a command was placed. This would allow for more context sensitive titles/icons without having to resort to multiple commands.There are multiple places in GitLens where I wished I had this ability (because often the multiple commands just isn't worth the extra complexity) -- where I want a different title for the command palette, editor context, etc, etc.
This is somewhat similar to #32526 - @jrieken I think this could also address that one -- since you could just have the same command listed twice with a different title/icon based on the
when
clauseHere is my ideal example below:
I've also included in this example
listHasMultipleSelections
(or something like it -- no selection, single selection, multiple selections would be ideal) that would be very helpful to have again to be more context-sensitive.Reproduces without extensions: Yes/No
The text was updated successfully, but these errors were encountered: