intellij-rust: All files show "File is not included in module tree, …"

Environment

  • IntelliJ Rust plugin version: 0.2.103.2131-192
  • Rust toolchain version: 1.36.0
  • IDE name and version: CLion 2019.2.1
  • Operating system: RHEL 7.6

Problem description

Since upgrading to CLion 2019.2.1, which probably upgraded the Rust plugin as well, all files show a bar, exception the main.rs show a bar “File is not included in the module tree, analysis is not available”.

This worked perfectly in the version before.

Steps to reproduce

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 23
  • Comments: 24 (6 by maintainers)

Most upvoted comments

this doesnt work if you are solving rustlings exercise. image

I had the same problem after updating the plugin. I invalidated caches and the problem went away.

@ctron Very weird stuff. Could you please try to invoke ctrl+shift+A “invalidate caches”?

Make sure you have used one of the functions declared in that file, the error will go away magically.

@166MMX You need to add a mod name; declaration for every file in your lib.rs or main.rs file.

I have the same issue and it is always reproducible on the Mac and Linux versions of currently newest CLion + Rust plugin:

CLion 2019.2.5 Build #CL-192.7142.39, built on October 29, 2019 Runtime version: 11.0.4+10-b304.77 amd64 Non-Bundled Plugins: org.toml.lang, org.rust.lang Rust plugin version: 0.2.109.2149-192

Reproducible scenario:

  1. Create empty project with main.rs file
  2. Add “async-std” to cargo toml
  3. Try to use any struct from async-std, for instance TcpListener

Expected result: I get autocompletion and suggestions for structures in the async-std crate

Actual result: the IDE behaves as if async-std is not added to cargo.toml

suggestions

When I manually navigate to the file/module I see the following message:

message

I’ve experienced the issue only with the async-std crate. I’ve tried to “restart & invalidate caches” but it did not help

@adamnemecek but it’s not true You haven’t include nested crates to top level lib.rs/main.rs. You need to add these crates to plugin project structure. You have two different ways to do it: crate single workspace for all crates in your project or attach nested crates to project structure directly. To make the second variant, just invoke Attach Cargo Project in context menu on nested_crate_dir directory or nested_crate_dir/Cargo.toml file Alternatively, invoke Attach action at the top of editor with opened nested_crate_dir/Cargo.toml file.

Context menu Editor notification
image image

I think this problem is related to accidental deletion of the .IML file. I accidentally deleted mine today and have this issue in CLion.

Edit: Simply deleting the .idea folder in your project will fix this issue; at least it did so for me.

Second edit: This fixed the issue for me at home but I still unfortunately have this problem at work. Deleting the .idea folder does not help.