Skip to content

"rust-analyzer failed to discover workspace" could be so much more helpful #13226

Open
@matklad

Description

@matklad

Today I've got to help a new Rust user to start their Rust project, and our logic to discovering Cargo.tomls was a huge roadblock. Comically gigantic I would say even :)

Basically, the project was in the subdir of the subdir, so nothing worked. But I wasn't able to diagnose on the spot! I had to do the "ok, let's create a new hello-world project and see if it works there" dance to debug this (and it was actually the person whom I was trying to help who said "huh, maybe the problem is that Cargo.toml is in a subdirectory?")

Here's a bunch of ways we can improve this:

  • if there are no projects, we should show red/yellow status.
  • in the status, and in the "rust-analyzer failed to discover workspace" error notification, we should say HOW TO ACTUALLY FIX THE PROBLEM (it's ridiculous that we don't do this, seeing this message from the newbie eyes really is painful)
  • at minimum, we should point at the linked projects settings
  • ideally, as suggested to me, there should be an "open Cargo.toml" link which opens open file dialog
  • and, yeah, it would be cool to suggesting adding Cargo.toml to linked projects if we notice it some time after opening a project (eg, opening a Rust file).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions