Mr.*_*.EU 7 visual-studio-code vscode-tasks
我可以使用in中的输入变量。launch.jsonlaunch.json
"configurations": [
{
...
"args": [${input:file_no}]
"preLanuchTask": "runPreTasks"
...
}
],
"inputs": [
{
"id": "file_no",
"type": "promptString"
}
]
Run Code Online (Sandbox Code Playgroud)
现在,我想访问相同的变量,而无需在 中再次输入输入tasks.json。
{
"version": "2.0.0",
"tasks":[
{
"label": "runPreTasks",
"type": "shell",
"command": sh,
"args": [
"/path2script/scriptName.sh",
"${input:file_no}" // This does not work, without defining input again
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
有没有办法在 vscode 中传递输入launch.json变量tasks.json?
根据 @rioV8 的回答,我编辑了我的json文件,如下所示:
launch.json:
"configurations": [
{
...
"args": [${input:file_no}]
"preLanuchTask": "runPreTasks"
...
}
],
"inputs": [
{
"id": "file_no",
"type": "command",
"command": "extension.commandvariable.promptStringRemember",
"args": {
"key": "lastnumber",
"description": "Enter the number"
}
}
]
Run Code Online (Sandbox Code Playgroud)
tasks.json:
{
"version": "2.0.0",
"tasks":[
{
"label": "runPreTasks",
"type": "shell",
"command": sh,
"args": [
"/path2script/scriptName.sh",
"${input:file_no}"
]
}
]
"inputs": [
{
"id": "file_no",
"type": "command",
"command": "extension.commandvariable.rememberPick",
"args": { "key": "lastnumber" }
}
]
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5088 次 |
| 最近记录: |