Example of project configuration with a task:

{
    "tasks": [
        {
            "_description": "Show the current file changes from git",
            "name": "diff",
            "cwd": "{workspaceFolder}",
            "args": ["meld", "{file}"]
        }
    ]
}

Details:

  • name: task identifier, will be available in the commandbar completion
  • cwd: optional working directory
  • args: array for the command and its parameters

Variables substitution uses the {variableName} syntax.

A list of predefined variables is available, based on VS Code ones (reference).

Environment variables can also be used, using the “env_” prefix, like {env_MY_ENV_VAR}.

When running as flatpak, you may have to use the flatpak-spawn wrapper to escape the sandbox, and setup the corresponding D-Bus permissions.

For assigning a keyboard shortcut to a task, use the global config:

[keybindings]
"cmd.task::build" = ["F4"]
"cmd.task::run" = ["F5"]