Skip to content

Hide commands based on when clause when command does not apply #18517

Closed

Description

@BillDenton
  • VSCode Version: Code 1.8.1 (ee428b0, 2016-12-19T14:49:23.350Z)
  • OS Version: Windows_NT ia32 6.1.7601
  • Extensions:
Extension Author Version
read-only-indicator alefragnani 0.4.0
alignment annsk 0.3.0
bettertab arenl 1.0.1
Doxygen bbenoist 1.0.0
python donjayamanne 0.5.5
EditorConfig EditorConfig 0.3.4
vscode-great-icons emmanuelbeziat 1.1.38
matlab Gimly81 0.4.0
status-bar-tasks GuardRex 0.1.2
vscode-dimmer hoovercj 2.1.0
docthis joelday 0.3.9
cpptools ms-vscode 0.9.3
vscode-clearcase OpenNingia 1.4.1
vscode-icons robertohuertasm 6.0.0
theme-cyanicpastels SamuelLampa 0.0.9
indenticator SirTori 0.2.1
vscode-hexdump slevesque 1.1.4
code-spell-checker streetsidesoftware 0.14.5
comment-snippets Tobiah 0.2.0
dark-plus-material vangware 0.1.4
change-case wmaurer 1.0.0
highlight-trailing-white-spaces ybaumes 0.0.2

Steps to Reproduce:

  1. Make sure all files are saved.
  2. Do command "Save All"
  3. 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.

Activity

  1. added
    info-needed
    and removed
    info-needed
    on Jan 13, 2017
  2. mjbvz commented on Jan 13, 2017

    @mjbvz
    Contributor

    Confirmed. I had to use the command palette to trigger save all

    The behavior for save all here 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

  3. LegoChicken commented on Jan 15, 2017

    @LegoChicken

    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).

  4. BillDenton commented on Jan 15, 2017

    @BillDenton
    Author

    Opps I've just commented in my other GitHub username (LegoChicken).

  5. BillDenton commented on Jan 15, 2017

    @BillDenton
    Author

    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?

  6. 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
  7. 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
  8. bpasero commented on Feb 23, 2017

    @bpasero
    Contributor

    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.

  9. Krzysztof-Cieslak commented on May 26, 2017

    @Krzysztof-Cieslak
    Contributor

    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.

  10. added
    quick-pick
    and removed on Nov 15, 2017
  11. removed this from the Backlog milestone on Nov 15, 2017
  12. bpasero commented on Oct 7, 2019

    @bpasero
    Contributor

    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".

  13. locked and limited conversation to collaborators on Nov 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

debtquick-pick

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions