rust-lang / rust-lang/rust-analyzer
linkedProjects doesn't seem to work with multi-root workspaces in vscode
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
rust-analyzer version: 0.3.1868-standalone (037924c4d 2024-03-03)
rustc version: rustc 1.76.0 (07dca489a 2024-02-04)
I have a multi root workspace in vscode and I want to manually specify the cargo.toml location but the linkedProjects option always took the first folder in the workspace as the base directory:
> folder_a
> folder_d
> folder_e
> cargo.toml
> folder_b
> folder_f
> folder_g
> cargo.toml
Then if I use the option in my_workspace.code-workspace:
{
"settings": {
"rust-analyzer.linkedProjects": [
"folder_b/folder_f/folder_g/cargo.toml",
]
},
}
It always search in folder_a/folder_b/folder_f/folder_g/cargo.toml. I tried with:
{
"settings": {
"rust-analyzer.linkedProjects": [
" ${workspaceFolder:folder_b}/folder_f/folder_g/cargo.toml",
]
},
}
Which allows to specify the sibling folder but it stills search in folder_a/${workspaceFolder:folder_b}/folder_f/folder_g/cargo.toml (literally).
I also tried using folders configuration in my_workspace.code-workspace:
{
"folders": [
{
"path": "folder_b",
"settings": {
"rust-analyzer.linkedProjects": [
"folder_f/folder_g/cargo.toml"
]
}
},
]
}
But it looks like is completely ignored.
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 by reproducing the multi-root workspace configuration and locating the handling of rust-analyzer.linkedProjects paths. Check how relative paths and folder-scoped settings are resolved, then verify that the cargo.toml under folder_b is found without being prefixed by folder_a. Confirm the behavior with a focused regression test if the existing test structure supports it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, vscode
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100