简体   繁体   English

带有WSL的VSCode扩展调试节点

[英]VSCode Extension Debugging Node with WSL

I'm attempting to debug a vscode extension in Windows using WSL. 我正在尝试使用WSL在Windows中调试vscode扩展。 It appears as though the prelaunchtask is using the cmd.exe arguments, which causes the prelaunchtask to fail with bash. 似乎预启动任务正在使用cmd.exe参数,这会导致预启动任务因bash失败。

Executing task: npm run watch < 执行任务:npm run watch <

/bin/bash: /d: No such file or directory The terminal process terminated with exit code: 127 / bin / bash:/ d:没有这样的文件或目录终端进程终止,退出代码:127

Terminal will be reused by tasks, press any key to close it. 终端将被任务重用,按任意键将其关闭。

Any thoughts how I might force the debug terminal to properly issue the bash arguments? 有什么想法可以迫使调试终端正确发出bash参数吗?

You can achieve this by manually specifying the shell executable and arguments used by the Extension launch configuration. 您可以通过手动指定扩展启动配置使用的shell可执行文件和参数来实现。 Assuming you are starting with the example extension , you can edit the task for the "npm: watch" script in .vscode/tasks.json, forcing it to launch WSL with no additional arguments. 假设您从示例扩展名开始,则可以在.vscode / tasks.json中编辑“ npm:watch”脚本的任务,强制其启动WSL而无需其他参数。

{
    "type": "npm",
    "script": "watch",
    "problemMatcher": "$tsc-watch",
    "isBackground": true,
    "presentation": {
        "reveal": "never"
    },
    "group": {
        "kind": "build",
        "isDefault": true
    },
    // Force this to use WSL with no additional arguments
    "options": {
        "shell": {
            "executable": "C:\\WINDOWS\\System32\\wsl.exe"
        },
        "args": []
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM