Skip to content
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

Pass parameters from keybindings.json to tasks.json #80

Open
JLLMNCHR opened this issue Jun 5, 2023 · 1 comment
Open

Pass parameters from keybindings.json to tasks.json #80

JLLMNCHR opened this issue Jun 5, 2023 · 1 comment

Comments

@JLLMNCHR
Copy link

JLLMNCHR commented Jun 5, 2023

Using the multi-command extension I am trying to pass a parameter from keybindings.json to tasks.json.

In this example, the idea is that, when saving (CTRL+s), the parameter 'par1' passed is shown in the terminal, in this case 'HELLO'.

But, I haven't seen that there is something like 'pars' in the extension documentation.

keybindings.json:

[
    {
        "key": "ctrl+s",
        "command": "extension.multiCommand.execute",
        "args": {
            "interval": 1000,
            "sequence": [
                {
                    "command": "workbench.action.files.save"
                },
                {
                    "command": "workbench.action.tasks.runTask",
                    "args": "Echo_Something",
                    "pars": [{"par1": "HELLO"}]
                }
            ]
        },
     }
]

tasks.json:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Echo_Something",
            "type": "shell",
            "command": "echo",
            "args": [
                "**************** ${par1} ****************"
            ],
            "group": "build",
            "presentation": {
                "reveal": "always",
                "panel": "shared"
            }
        }
    ]
}
@ryuta46
Copy link
Owner

ryuta46 commented Jun 5, 2023

Do the runTask command and pars field work as expected by themselves?
Since this extension executes the specified commands in sequence, you must first make sure that one command works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants