Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multi-root workspace in vscode #1104

Closed
zimond opened this issue Apr 4, 2019 · 7 comments
Closed

Support multi-root workspace in vscode #1104

zimond opened this issue Apr 4, 2019 · 7 comments
Labels
E-hard E-has-instructions Issue has some instructions and pointers to code to get started good first issue

Comments

@zimond
Copy link

zimond commented Apr 4, 2019

I think we could use the approach in https://github.com/rust-lang/rls-vscode/pull/333/files, start analyzer for every dir in the workspace

@matklad
Copy link
Member

matklad commented Apr 4, 2019

We don’t need to start separate instances of analyzer, the code is well prepared to handling arbitrary crate graphs. This is he bit where this happens: https://github.com/rust-analyzer/rust-analyzer/blob/84d8665e13007b0ee27e2a42ff74db815923cdce/crates/ra_lsp_server/src/main_loop.rs#L60

As you see, we already construct a vector of workspaces(of length one at the moment).

To support multiroot setup, we should extend this code to scan several roots

@matklad matklad added E-hard E-has-instructions Issue has some instructions and pointers to code to get started good first issue labels Apr 4, 2019
@jrvidal
Copy link
Contributor

jrvidal commented Apr 7, 2019

I've been experimenting a bit with this and it looks like VSCode reloads the extension completely when a folder is added to the workspace. That would mean that supporting multiple workspaces doesn't yet require full-fledged dynamic workspace loading. I could prepare a PR for this "hack" and/or work on the "full" solution later (if nobody is working on this).

Maybe related/interesting microsoft/vscode#28122

@matklad
Copy link
Member

matklad commented Apr 8, 2019

@jrvidal if the "hack" works for your / @zimond use-case, I'd be happy to merge it.

And yeah, loading ws dynamically would be much harder then just reloading the whole thing: the latter would require changes to how vfs works, which is a whole new can of worms.

jrvidal added a commit to jrvidal/rust-analyzer that referenced this issue Apr 11, 2019
jrvidal added a commit to jrvidal/rust-analyzer that referenced this issue Apr 14, 2019
@matklad matklad closed this as completed Apr 14, 2019
@CMCDragonkai
Copy link

Does multiroot workspace really work? I've got a workspace, with projects, and within a particular project, there is subdirectory with the rust project.

I read somewhere that this extension only detects rust projects 1 level deep. Is there a way to configure this or to tell the extension where the rust project is?

@bjorn3
Copy link
Member

bjorn3 commented Nov 12, 2022

You can use the rust-analyzer.linkedProjects config in case rust-analyzer failed to auto-detect it. Make sure to also include the Cargo.toml files that previously got auto-detected. Setting it disables all auto-detection.

@iamshreeram
Copy link

Hi @bjorn3 / @matklad , Has there been any update on the "multi-root workspace" feature in the past year? I have a similar question that I posted (#16030). Would you please review it?

@erikschul
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-hard E-has-instructions Issue has some instructions and pointers to code to get started good first issue
Projects
None yet
Development

No branches or pull requests

7 participants