You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Hide commands based on when clause when command does not apply #18517
Error message "Command 'Files: Save All' is not enabled in the current context."
It is unclear as to what this means. As all files are already saved either no message should appear or the message should state that all files are already saved or there are no files to save to something like that. The existing information message doesn't provide useful information.
Note, in my original report all the files were saved (i.e. no dirty files). I usually use Ctrl+Shift+P Save All as I haven't learnt the key sequence yet. The issue was that the error message didn't indicate that there were no files to be saved. To me the error message didn't make any sense. There may be other issues as indicated by Matt Bierner (@mjbvz).
Matt Bierner (@mjbvz) I've just checked using Ctrl+K S. There is no message when there are no files to save. Whereas using Command Save All there is a message. I think it safe to silently do nothing. So there should be no message when all the files are already saved when it used via keyboard sequence of command prompt. Only reason to have a message would be to give the user feedback to indicate that the save all had been done. However, I guess the only option is use an Info message which they would have to manually clear. It there any way of having indication that disappears have automatically after a short while?
changed the title [-]Meaning of "Command 'Files: Save All' is not enabled in the current context." is unclear[/-][+]Unhelpful info message when invoking disabled actions from command palette[/+]on Jan 16, 2017
changed the title [-]Unhelpful info message when invoking disabled actions from command palette[/-][+]Hide commands based on when clause when command does not apply[/+]on Feb 23, 2017
I think the better fix is to hide commands from the F1 list that cannot be executed in the current context. E.g. a command that needs files to be dirty should register a when clause filesDirty or similar.
There is small problem with this approach (as far as I understand) - when clauses are defined on the keyboard binding level, not on command level. It would be good to add possibility to define when clause for the command, and this would control whether command is active at all (and displayed in command palette) .
Also, I'd like to see ability of hide command from palette (while keeping it active) - this would be useful for commands defined just for sake of context menus, which shouldn't be necessarily displayed in palette.
There are probably 200 commands that are just registered global and not via commands. If there is a particular command we should look at, please file a new issue.
As for this issue, I can no longer reproduce with "Save All".
Activity
mjbvz commentedon Jan 13, 2017
Confirmed. I had to use the command palette to trigger
save allThe behavior for
save allhere seems different when using the command from the palette, vs the keyboard shortcut or the menu item.Benjamin Pasero (@bpasero) Can you please take a look or assign a better owner
LegoChicken commentedon Jan 15, 2017
Note, in my original report all the files were saved (i.e. no dirty files). I usually use Ctrl+Shift+P Save All as I haven't learnt the key sequence yet. The issue was that the error message didn't indicate that there were no files to be saved. To me the error message didn't make any sense. There may be other issues as indicated by Matt Bierner (@mjbvz).
BillDenton commentedon Jan 15, 2017
Opps I've just commented in my other GitHub username (LegoChicken).
BillDenton commentedon Jan 15, 2017
Matt Bierner (@mjbvz) I've just checked using Ctrl+K S. There is no message when there are no files to save. Whereas using Command Save All there is a message. I think it safe to silently do nothing. So there should be no message when all the files are already saved when it used via keyboard sequence of command prompt. Only reason to have a message would be to give the user feedback to indicate that the save all had been done. However, I guess the only option is use an Info message which they would have to manually clear. It there any way of having indication that disappears have automatically after a short while?
[-]Meaning of "Command 'Files: Save All' is not enabled in the current context." is unclear[/-][+]Unhelpful info message when invoking disabled actions from command palette[/+][-]Unhelpful info message when invoking disabled actions from command palette[/-][+]Hide commands based on when clause when command does not apply[/+]bpasero commentedon Feb 23, 2017
I think the better fix is to hide commands from the F1 list that cannot be executed in the current context. E.g. a command that needs files to be dirty should register a
whenclausefilesDirtyor similar.Krzysztof-Cieslak commentedon May 26, 2017
There is small problem with this approach (as far as I understand) -
whenclauses are defined on the keyboard binding level, not on command level. It would be good to add possibility to definewhenclause for the command, and this would control whether command is active at all (and displayed in command palette) .Also, I'd like to see ability of hide command from palette (while keeping it active) - this would be useful for commands defined just for sake of context menus, which shouldn't be necessarily displayed in palette.
bpasero commentedon Oct 7, 2019
There are probably 200 commands that are just registered global and not via commands. If there is a particular command we should look at, please file a new issue.
As for this issue, I can no longer reproduce with "Save All".