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

VSCode plugin: Add a setting for which subdirectories should be considered Cargo workspaces #3326

Closed
malte-v opened this issue Feb 26, 2020 · 6 comments

Comments

@malte-v
Copy link

malte-v commented Feb 26, 2020

Not sure if this is already possible or has been asked before, but how do I handle a project like this?

<vscode workspace root>
- my_rust_project/
  - src/
  - Cargo.toml
- some_other_stuff/
  - ...
- Dockerfile

Currently, the plugin just complains about not finding a Cargo.toml in the workspace root. I know I could just use multiple VSCode workspaces, but I'm not a big fan of that because it would get quite messy in more complex project layouts.

I would suggest adding a rust-analyzer.cargoWorkspaces setting to the VSCode plugin that allows one to specify multiple subdirectories which should be considered Cargo workspaces.

@lnicola
Copy link
Member

lnicola commented Feb 26, 2020

#3309 would pretty much fix this.

@malte-v
Copy link
Author

malte-v commented Feb 26, 2020

You're right, sorry for the duplicate.

@malte-v malte-v closed this as completed Feb 26, 2020
@TzviPM
Copy link

TzviPM commented Jul 7, 2022

In case anyone else runs into this, one solution that works for more deeply nested rust crates is to add a Cargo.toml file in the root folder of the project with a workspace config that references the nested folders with rust crates.

@pravic
Copy link

pravic commented Aug 23, 2022

Can we make #3309 configurable how deep to look?
Or can we add a configuration option to specify the path to the main Cargo.toml?

Because now it's either a totally manual rust-project.json or to open an additional VSCode instance with an inner folder.

@flodiebold
Copy link
Member

Because now it's either a totally manual rust-project.json or to open an additional VSCode instance with an inner folder.

It's not; you just have to specify linkedProjects.

@pravic
Copy link

pravic commented Aug 23, 2022

@flodiebold Do you mean that linkedProjects can point to Cargo.toml?

Exactly:

Elements must be paths pointing to Cargo.toml, rust-project.json, or JSON objects in rust-project.json format.

Thanks!

lnicola pushed a commit to lnicola/rust-analyzer that referenced this issue Apr 7, 2024
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this issue Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants