Skip to content

Allow separate when clauses for each command in a keybinding with multiple commands #184288

Open
@User087

Description

@User087

Currently, it seems that 'when' clauses in keybindings are associated with an entire keybinding rather than the individual commands within it. I suggest associating when clauses with commands so that it would be possible in a keybinding with multiple commands to have separate when clauses for each, and whether each command is run in a particular instance depends on whether its respective when clause is fulfilled.

So a keybinding would look something like:

{
    "key": "key",
    "command": "runCommands",
    "args": {
        "commands": [
            {
                "command": "command1",
                "args": {
                    "arg1": "value1",
                    "arg2": "value2"
                },
                "when": "condition1"
            },
            {
                "command": "command2",
                "when": "condition2"
            },
            {
                "command": "command3",
                "when": "condition3",
            },
        ]
    }
}

so upon pressing key, if only condition2 is fulfilled and not condition1 and condition3, then only command2 gets run, and if condition1 and condition2 are both fulfilled and not condition3, then command1 gets run, and then command2 gets run (i.e. sequentially as usual), etc.

Metadata

Metadata

Assignees

Labels

feature-requestRequest for new features or functionalityrunCommandsIssues related to command 'runCommands'

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions