Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

RLS doesn't support multiple projects in a folder #478

Closed
simobiggs opened this issue Dec 18, 2018 · 4 comments
Closed

RLS doesn't support multiple projects in a folder #478

simobiggs opened this issue Dec 18, 2018 · 4 comments

Comments

@simobiggs
Copy link

If you open a folder which contains multiple rust projects (example below) you get the following error.

A Cargo.toml file must be at the root of the workspace in order to support all features

This error makes sense, but it would be nice to support all of the projects within a root folder rather than opening multiple windows (one per project).

Workspace
    project 1
        cargo.toml
    project 2
        cargo.toml
@LaylBongers
Copy link

You need to use cargo workspaces for this:
https://doc.rust-lang.org/book/ch14-03-cargo-workspaces.html

@simobiggs
Copy link
Author

Thanks, this is the solution

@xypnox
Copy link

xypnox commented Jul 2, 2019

Hi, My usecase is a bit different.

How do I have non-dependent multiple projects that generate different non related binaries in a same repository?

I am planning to keep all my rust programs in a single repo for consistency and brevity. I am still a beginner and would prefer them all at one place.

The problem I am facing is that when I load the project directory in VS Code, I cannot build projects inside a directory. For example I have a project in /book/guessing_game with Cargo.toml in the guessing_game directory.

I want that the rust-extension should build and run the project as is. However, It doesn't. And it instead complains of the missing cargo.toml file in the root directory.

How can I achieve this?

@simobiggs
Copy link
Author

This is the same problem I had. You need to create a new Cargo.toml in the root directory, and point it to those projects. Look through the link LaylConway provided.

If you are using git, you will also need to make a new .gitignore in the root. Use the .gitignore files generated by cargo new as reference for the rules you will need.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants