omdit
omdit

Reputation: 121

How to set command argument in vscode task.json?

I would like to automate extension setting with some arguments on task runner in VSCode. How can I set arguments:

I tried something like :

{
    "version": "2.0.0",
    "tasks": [         
          {
            "label": "spark setting",
            "command": "${command:hdinsight.linkCluster}",
          },
}

I tried applying "args" section :

 {
    "version": "2.0.0",
    "tasks": [         
          {
            "label": "spark setting",
            "command": "${command:hdinsight.linkCluster}",
            "args": ["Generic Livy Endpoint", "htttp://*****"]
          },
}

But it seems doesn't work to automate.

The extension command 'linkCluster' requires both menu selection and string argument which is URI.

Upvotes: 2

Views: 1367

Answers (1)

untore
untore

Reputation: 623

I haven't found a way to specify the args if you use the command variables directly in the task definition, but inputs (despite the name) allow commands with arguments:

    tasks": [
        {
            "label": "mytask",
            "command": "${input:first}",
        }
    ],
    "inputs": [
        {
          "id": "first",
          "type": "command",
          "command": "hdinsight.linkCluster",
          "args": ["Generic Livy Endpoint", "htttp://*****"]
       ]
    
        

Upvotes: 1

Related Questions