【问题标题】:How to set command argument in vscode task.json?如何在 vscode task.json 中设置命令参数?
【发布时间】:2020-08-05 11:42:13
【问题描述】:

我想在 VSCode 的任务运行器上使用一些参数自动扩展设置。 如何设置参数:

  • 字符串参数
  • 菜单选择

我试过类似的东西:

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

我尝试应用“args”部分:

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

但自动化似乎行不通。

扩展命令“linkCluster”需要菜单选择和字符串参数,即 URI。

【问题讨论】:

    标签: vscode-settings vscode-extensions vscode-tasks


    【解决方案1】:

    如果您在任务定义中直接使用command 变量,我还没有找到指定参数的方法,但是输入(尽管有名称)允许带有参数的命令:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-08-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-28
      • 1970-01-01
      • 2020-06-24
      相关资源
      最近更新 更多