rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.09k stars 1.57k forks source link

rust-analyzer failed to discover workspace, no Cargo.toml found #4181

Closed hexpunk closed 4 years ago

hexpunk commented 4 years ago

I get the following error message in my project:

rust-analyzer failed to discover workspace, no Cargo.toml found, dirs searched: /home/user/code/rust-advent-of-code

My directory structure is maybe a little unusual. There's not one main Cargo.toml file. There are many programs within the directory structure.

.
└── 2015
    ├── 01
    │   ├── Cargo.toml
    │   ├── generate_input.sh
    │   ├── input.txt
    │   ├── README.md
    │   └── src
    │       └── main.rs
    ├── 02
    │   ├── Cargo.toml
    │   ├── input.txt
    │   ├── README.md
    │   └── src
    │       └── main.rs
    ├── 03
    │   ├── Cargo.toml
    │   ├── input.txt
    │   ├── README.md
    │   └── src
    │       └── main.rs
    ├── 04
    │   ├── Cargo.toml
    │   ├── README.md
    │   └── src
    │       ├── main.rs
    │       └── md5.rs
    ├── 05
    │   ├── Cargo.toml
    │   ├── input.txt
    │   ├── README.md
    │   └── src
    │       └── main.rs
    ├── 06
    │   ├── Cargo.toml
    │   ├── input.txt
    │   ├── README.md
    │   └── src
    │       └── main.rs
    ├── 07
    │   ├── Cargo.toml
    │   ├── input.txt
    │   ├── README.md
    │   └── src
    │       └── main.rs
    ├── 08
    │   ├── Cargo.toml
    │   ├── input.txt
    │   ├── README.md
    │   └── src
    │       └── main.rs
    ├── 09
    │   ├── Cargo.toml
    │   ├── input.txt
    │   ├── README.md
    │   └── src
    │       └── main.rs
    ├── 10
    │   ├── Cargo.toml
    │   ├── README.md
    │   └── src
    │       └── main.rs
    └── 11
        ├── Cargo.toml
        ├── README.md
        └── src
            └── main.rs

FWIW, RLS handles this situation without issue.

bjorn3 commented 4 years ago

https://github.com/rust-analyzer/rust-analyzer/issues/1798