-
Notifications
You must be signed in to change notification settings - Fork 34.7k
Description
- VSCode Version: Code - Insiders 1.16.0-insider (b73b7df, 2017-08-14T05:16:07.578Z)
- OS Version: Windows_NT x64 10.0.16257
Currently it is difficult to "simulate" the changing of an icon of a command. Since the api doesn't allow changing the icon directly, it has to be simulated by using extra commands and contexts.
For example, in GitLens I've recently added a new "feature" to show a sort of progress indicator on the gitlens.toggleFileBlame
command while I am computing the blame annotations (the icon pulses), and then once completed I change the blame icon to be in an "on" state to indicate that the blame is active (the icon turns orange).
To accomplish this I have to create 3 commands, the original gitlens.toggleFileBlame
command for the off
state, gitlens.computingFileAnnotations
command which is a no-op for the progress
state, and gitlens.clearFileAnnotations
for the on
state. You can see definition of 3 commands here. And the usage of those commands can be seen here
Instead of having 3 command for this, I would much rather have been able to have a single command:
{
"command": "gitlens.toggleFileBlame",
"title": "Toggle File Blame Annotations",
"category": "GitLens",
"icon": {
"dark": "images/dark/git-icon.svg",
"light": "images/light/git-icon.svg",
"when": !gitlens:annotationStatus
},
"icon": {
"dark": "images/dark/git-icon-progress.svg",
"light": "images/light/git-icon-progress.svg",
"when": gitlens:annotationStatus == computing
},
"icon": {
"dark": "images/dark/git-icon-orange.svg",
"light": "images/light/git-icon-orange.svg",
"when": gitlens:annotationStatus == computed
}
}
That way I wouldn't need to switch the commands out in each menu (currently I'm being lazy and only doing it on the editor/title navigation), the keyboard shortcuts show up as expect, and I don't need to register extra commands that I don't actually need.