【问题标题】:Can't debug Rust code inside vscode with WSL setup无法使用 WSL 设置在 vscode 中调试 Rust 代码
【发布时间】:2022-11-04 16:20:29
【问题描述】:

我无法使用安装在 Windows 上的 VScode 调试 WSL 中的 rust 代码。我在debug 期间收到这些错误。

Error: there is no registered task type 'codelldb.cargo'. Did you miss installing an extension that provides a corresponding task provider?
Error: there is no registered task type 'codelldb.cargo'. Did you miss installing an extension that provides a corresponding task provider?

这是我的launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "lldb",
            "request": "launch",
            "name": "Debug executable 'foo'",
            "cargo": {
                "args": [
                    "build",
                    "--bin=foo",
                    "--package=foo"
                ],
                "filter": {
                    "name": "foo",
                    "kind": "bin"
                }
            },
            "args": [],
            "cwd": "${workspaceFolder}"
        },
    ]
}

奇怪的是,我可以使用 vscode run 我的代码并获得预期的输出。

我在 vscode 中为 WSL 安装了以下扩展

codeLLDB
rust-analyzer

这些是软件的版本

WSL: version 1
vscode: 1.72.2
windows : Windows 10

我在这里缺少什么

【问题讨论】:

  • 如果您单击fn main() 旁边的“调试”按钮,它是否有效? (需要安装rust-analyzer 插件)
  • 不,它在那里也不起作用
  • 可悲的是不能帮助你,我在 WSL2 上,它对我有用。如果有人有类似的问题,也许看看 rust-analyzer 错误跟踪器?

标签: visual-studio-code rust windows-subsystem-for-linux


【解决方案1】:

此问题是由于 WSL 版本造成的。将 WSL 从 v1 升级到 v2 后问题得到修复

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-09-11
    • 2019-01-01
    • 2020-04-16
    • 2021-05-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多