Skip to content

rust-analyzer failed to discover workspace: Sounds like wrong assumptions being made about human behaviour #13371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cottrell opened this issue Oct 9, 2022 · 5 comments

Comments

@cottrell
Copy link

cottrell commented Oct 9, 2022

VSCode shows old rust-lang extensions is deprecated. Pushes everyone towards this one. When this one is installed you get errors about "failed to discover workspace" and click through (to def) doesn't work. I suspect this is due to wrong assumptions being made that humans will open one vscode window per rust project. This is not how vscode is used. You open a top level folder with many projects in it and use vscode to search and work on all of them.

The extension should search for "nearest" Cargo.toml to the file being viewed and maintain scopes. Typically one is in src/ somewhere and ../Cargo.toml is good guess. Not sure if there is an option for that but it should be default.

@cottrell
Copy link
Author

cottrell commented Oct 9, 2022

@cottrell
Copy link
Author

cottrell commented Oct 9, 2022

This thread indicates it is not enabled. https://www.reddit.com/r/rust/comments/n1crnt/rustanalyzer_doesnt_want_to_work/

If it is in alpha state it definitely should not be the recommended extension in vscode. If there is a fix, we should try to bump it up in the search results.

@cottrell
Copy link
Author

cottrell commented Oct 9, 2022

This might be a workaround but is not obvious (5 s) https://rust-analyzer.github.io/manual.html#non-cargo-based-projects

@cottrell
Copy link
Author

cottrell commented Oct 9, 2022

@flodiebold
Copy link
Member

Duplicate of #13226 and others. (If you need a workaround and don't want to just open the project folder, setting rust-analyzer.linkedProjects as described in your first link is the way to go.)

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

No branches or pull requests

2 participants