Skip to content

Failed to discover workspace #575

Description

@mgeisler

Hi folks, thank you so much for making rust-mode, I use it every day together with rustic-mode.

I filled emacs-rustic/rustic#110 yesterday, but the issue might actually belong here?

The tl;dr is that rust-analyzer isn't able to auto-discover the Cargo workspace if what Emacs/Eglot considers the projects root — computed with (project-root (project-current)) — doesn't match what Cargo considers the root.

By default, the Emacs project root is defined by the VCS folder, typically a .git directory. So this project layout works fine:

project/
  .git/
  Cargo.toml
  src/
    lib.rs

as does this layout since rust-analyzer recurses one level deep in its auto-discovery:

project/
  .git/
  rust/
    Cargo.toml
    src/
      lib.rs

However, this one fails:

project/
  .git/
  rust/
    foo/
      Cargo.toml
      src/
        lib.rs

I've added my own function to project-find-functions and it seems to work okay (see emacs-rustic/rustic#110). I would love an expert to look it over, and if possible, include it in rust-mode or rustic-mode.

Feel free to close either issue since they're effectively duplicates of each other (I just didn't know where to file this).

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions