-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Allow opening rust-analyzer on a single file #6388
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
Comments
Note that there is a way to run |
Those docs are intended for using some build system other than cargo, like x.py or bazel or something. I'm asking for support for very small projects that have no dependencies, only a single rust file. |
Another use case would be for org-babel the emacs + org-mode literate programming environment that creates files in temp and enables users to write short snippets. Adding rust-analyzer support for individual files would be great for this as well. |
Can rust-analyzer not just default to the directory containing |
@jomala this is for projects not using cargo, where there is no Cargo.toml file. |
The error I was receiving was: I resolved the issue by creating a file named {
"sysroot_src": "/home/<YOUR-USER>/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library",
"crates": [
{
"root_module": "main.rs",
"edition": "2018",
"deps": []
}
]
}
|
@zzzachzzz this works for me without a |
Currently,
code x.rs
(where x.rs is any self-contained source file) gives the errorCannot activate rust-analyzer: no folder is opened
. It would be nice to have this work ifx.rs
doesn't require any external dependencies. That would allow running rust-analyzer even on projects not using cargo.The text was updated successfully, but these errors were encountered: