rust-lang / rust-lang/rust-analyzer
FR: Run and debug from install directory
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
In VSCode I have setup the following launch configuration:
{
"type": "lldb",
"request": "launch",
"name": "Install & Debug 'hello_world'",
"cargo": {
"args": [
"install",
"hello_world",
"--debug",
"--bin=hello_world",
"--path=./FirstEngine/samples/hello_world",
"--root=./__out-install",
"--target-dir=./__out-target",
],
"filter": {
"name": "hello_world",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}"
},
I can run the above configuration with Rust 1.58 beta but it doesn't seem to do what I expect: to install, run and debug the executable from the install directory.
It looks like the artifact from the build directory is the one that's executed.
I expect the launch directory to be:
X:\Rust\FirstEngine\__out-install\bin
instead the output in the debug console is:
Launching: x:\Rust\FirstEngine\__out-target\release\hello_world.exe
Launched process 17164
Process exited with code 0.
And the output:
Running `cargo install hello_world --bin=hello_world --path=./FirstEngine/samples/hello_world --root=./__out-install --target-dir=./__out-target --message-format=json`...
Installing hello_world v0.1.0 (X:\Rust\FirstEngine\FirstEngine\samples\hello_world)
Updating crates.io index
Finished release [optimized] target(s) in 1.10s
Replacing ./__out-install\bin\hello_world.exe
Replaced package `hello_world v0.1.0 (X:\Rust\FirstEngine\FirstEngine\samples\hello_world)` with `hello_world v0.1.0 (X:\Rust\FirstEngine\FirstEngine\samples\hello_world)` (executable `hello_world.exe`)
warning: be sure to add `./__out-install\bin` to your PATH to be able to run the installed binaries
Raw artifacts:
{
fileName: 'x:\\Rust\\FirstEngine\\./__out-target\\release\\hello_world.exe',
name: 'hello_world',
kind: 'bin'
}
Filtered artifacts:
{
fileName: 'x:\\Rust\\FirstEngine\\./__out-target\\release\\hello_world.exe',
name: 'hello_world',
kind: 'bin'
}
configuration: {
type: 'lldb',
request: 'launch',
name: "Install & Debug 'hello_world'",
args: [],
cwd: '${workspaceFolder}',
__configurationTarget: 5,
relativePathBase: 'x:\\Rust\\FirstEngine',
program: 'x:\\Rust\\FirstEngine\\./__out-target\\release\\hello_world.exe',
sourceLanguages: [ 'rust' ]
}
Listening on port 54136
[adapter\src\terminal.rs:104] FreeConsole() = 1
[adapter\src\terminal.rs:105] AttachConsole(pid) = 1
[adapter\src\terminal.rs:109] FreeConsole() = 1
Debug adapter exit code=0, signal=null.
What would be required to enable such workflow: launch and/or debug from a install directory? This would be especially useful when developing an application which needs to run from a specific location.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the VSCode LLDB launch configuration and the cargo install output shown in the issue, especially the raw and filtered artifact paths. Trace how the launch configuration selects the executable after cargo install. Done means the workflow can launch and debug the executable from __out-install\bin rather than the build directory.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, vscode
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100