-
Notifications
You must be signed in to change notification settings - Fork 1.8k
unresolved import
for some `#[path = ".."]
#3898
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
It seems unlikely that we'll ever support these. The set of files we look at has to be limited by design, and ".rs files in the workspace or dependencies" is a pretty reasonable set, I think. The only solution I could maybe imagine is having a setting for extra files. |
I ran into a similar issue. I'll post it here. Defining local dependencies outside of the workspace in cargo.toml as such also has weird behaviour.
In this case, it does not output any error or warning, but also does not compute types/suggestions/tree/docs. |
The problem here is that we aren't just limiting ourselves to looking at files in the workspace, but in the package. That means that no files in parents of |
I run into same issue. Is there any progress? |
rust-analyzer does not access files outside the workspace of a project. rust-lang/rust-analyzer#3898 Cargo works fine, however working with an IDE becomes problematic when using relative imports. Therefore, I'll just duplicate the code instead of using relative mod paths.
Basically this. In my particular project, it basically makes rust-analyzer as well as VSCode useless for working with Rust. My project structure looks as follows:
Now, since my submodule folder is used in both my binary crates and my library crate, it needs to be above them in the directory hierarchy. But my workspace members' cargo.toml are one directory below. Rust-analyzer does not allow this project structure, either forcing me to include this submodule three times as a subdirectory of all 3 crates, or copying my shared source files over many times. |
Currently I worked around it by adding a symlink to the submodule inside each crate that depends on it. In general, symlinks can be used as a workaround here from the directory that contains the lib.rs to the external directory to achieve the same thing as the #[path = "../../foo"] statement. |
stable-x86_64-unknown-linux-gnu
(1.42.0)unresolved import
errors show up for:rs
workspace_root
or somewhere?)These files do exist.
The text was updated successfully, but these errors were encountered: