VSCode自定义任务不提示输入

问题描述 投票:0回答:1

转向在 CentOS 7 下使用 VSCode。

tasks.json
下有以下
${workspaceFolder}/.vscode

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Test task",
            "type": "shell",
            "command": "echo ${input.param}",
            "problemMatcher": []
        }
    ],
    "inputs": [
        {
            "id": "param",
            "description": "Type some text",
            "type": "promptString",
            "default": "Hello world!"
        }
    ]
}

可以通过在菜单栏中选择“终端 -> 运行任务”来启动“测试任务”。

任务启动但未出现“param”输入提示。终端输出是:

 *  Executing task: echo ${input.libraryName} 

/bin/bash: ${input.libraryName}: bad substitution

 *  The terminal process "/bin/bash '-c', 'echo ${input.libraryName}'" failed to launch (exit code: 1). 
 *  Terminal will be reused by tasks, press any key to close it. 

VSCode 帮助->关于的输出:

Version: 1.83.1
Commit: f1b07bd25dfad64b0167beb15359ae573aecd2cc
Date: 2023-10-10T23:45:31.402Z
Electron: 25.8.4
ElectronBuildId: 24154031
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Linux x64 3.10.0-1160.45.1.el7.x86_64
visual-studio-code centos7 vscode-tasks
1个回答
0
投票

感谢@rioV8的及时建议,可行的解决方案是:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Test task",
            "type": "shell",
            "command": "echo ${input:param}",
            "problemMatcher": []
        }
    ],
    "inputs": [
        {
            "id": "param",
            "description": "Type some text",
            "type": "promptString",
            "default": "Hello world!"
        }
    ]
}
© www.soinside.com 2019 - 2024. All rights reserved.