在vscode上调试bash shell时如何设置launch.json

时间:2017-06-05 08:19:05

标签: bash visual-studio-code

我想在vscode上通过bashdb调试bash shell,但似乎需要设置launch.json。

我该怎么做呢。

似乎编辑了scriptPath ...?

enter image description here

1 个答案:

答案 0 :(得分:0)

IDE ${command.AskForScriptName}中使用${file}替换launch.json来运行/调试当前打开的脚本:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Bash-Debug (type in script name)",
            "type": "bashdb",
            "request": "launch",
            "scriptPath": "${file}",
            "commandLineArguments": "",
            "windows": {
                "bashPath": "C:\\Windows\\sysnative\\bash.exe"
            },
            "linux": {
                "bashPath": "bash"
            },
            "osx": {
                "bashPath": "bash"
            }
        }
    ]
}

您也可以对特定文件进行硬编码:

<强> Linux的:

"scriptPath": "${workspaceRoot}/test.sh"

<强>窗:

"scriptPath": "${workspaceRoot}\\test.sh"