vadimcn / codelldb

A native debugger extension for VSCode based on LLDB
https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb
MIT License
2.42k stars 237 forks source link

Doesn't work for "cargo test" when the project is in a sub-directory of ${workspaceFolder} #1048

Closed michaeleisel closed 5 months ago

michaeleisel commented 6 months ago

OS: Ubuntu 22.04 VSCode version: 1.85.1 CodeLLDB version: 1.10.0 Compiler: rust Debuggee: a cargo test run

When I try to run cargo test in a debugger for my project, it fails, saying could not find Cargo.toml in /path/to/workspaceDirectory. This is because my project is actually in /path/to/workspaceDirectory/rust. Here you can see the config I used, with some fruitless attempts at using cwd and relativePathBase. It'd be great to be able to do this without having to move my Rust project into my large VSCode project's root directory.

            "type": "lldb",
            "cwd": "/home/meisel/projets/FourthMoment/rust",
            "relativePathBase": "/home/meisel/projets/FourthMoment/rust",
            "request": "launch",
            "name": "Cargo test",
            "cargo": {
                "relativePathBase": "/home/meisel/projets/FourthMoment/rust",
                "args": [
                    "test",
                    "--no-run",
                    "--lib"
                ]
            },
            "args": []
        }
NMontanaBrown commented 5 months ago

Hi @michaeleisel , I found the same issue, but fixed it with the following config:

 {
            "type": "lldb",
            "request": "launch",
            "name": "Debug unit tests in executable 'repo/libs/some-app'",
            "args": [],
            "cwd": "${workspaceFolder}/libs/some-app/",
            "cargo": {
                "args": [
                    "test",
                    "--no-run",
                    "--manifest-path=${workspaceFolder}/libs/some-app/Cargo.toml",
                ],
            },

        }

Let me know if this helps.

michaeleisel commented 5 months ago

Works great, thanks 👍