Skip to content

Multi-root workspace in vscode #16030

@iamshreeram

Description

@iamshreeram

This is how my vscode workspace appears:

~
 | /.cargo/
 | /.cabal/
 | /.nvm/
 | .bash_profile
 | .bashrc
 | /project/
 |  | /Clojure/
 |  |  | /allmycljprojects 
 |  | /Shell/
 |  |  | /allmybashprojects 
 |  | /rust/
 |  |  | /proj
 |  |  |  | /project-1
 |  |  |    | /src
 |  |  |       | main.rs
 |  |  |    | Cargo.toml
 |  |  |    | Cargo.lock
 |  |  |  | /project-2
 |  |  |    | /src
 |  |  |       | lib.rs
 |  |  |    | Cargo.toml
 |  |  |    | Cargo.lock
 |  |  |  | /project-3
 |  |  |    | /src
 |  |  |       | main.rs
 |  |  |    | Cargo.toml
 |  |  |    | Cargo.lock
 |  |  | /wasm
 |  |  |  | http-server
 |  |  |    | /src
 |  |  |       | main.rs
 |  |  |    | Cargo.toml
 |  |  |    | Cargo.lock
 |  |  | /ml
 |  |  |  | /sklearn-rs
 |  |  |    | /src
 |  |  |       | main.rs
 |  |  |    | Cargo.toml
 |  |  |    | Cargo.lock
 |  | /haskell/
 |  |  | /allmyhaskellprojects
 |  | /python/
 |  |  | /allmypythonprojects 
 |  | /go/
 |  |  | /bin
 |  |  | /pkg
 |  |  | /src
 |  |  |  | /github.com
 |  |  |    | /tarekbadrshalaan/
 |  |  |    | /elastic  
 |  |  |  | /gecgithub.com
 |  |  |    | /ers 
 |  |  |      | /ocf-gql
 |  |  |         | go.mod
 |  |  |         | go.lock
 |  |  |         | cmd
 |  |  |      | /dummy-app
 |  |  |         | go.mod 
 |  |  |  | /gitlab.com
 |  |  |  | /golang.org
 |  |  |  | /gopkg.in
 |  | /scala/
 |  |  | /allmyscalaprojects
 |  | /node/
 |  |  | /allmynodeprojects

I used rust-analyzer.linkedProjects in settings.json to enable auto-completion with RALS (Rust Analyzer Language Server). It worked well, but I had to modify the settings whenever I created a new cargo project.

To address this, I started updating rust's workspace.members manually with all my Cargo.toml paths to track them. It is manageable but still requires manual effort.

  1. Is this a recommended practice?
  2. Is there a way to automate this process and allow vscode RALS to track all Cargo.toml files within a specific folder on its own, and by eliminating the need for manual updates?

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-supportCategory: support questions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions