Skip to content
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

All files show "File is not included in module tree, …" #4302

Closed
ctron opened this issue Aug 23, 2019 · 24 comments
Closed

All files show "File is not included in module tree, …" #4302

ctron opened this issue Aug 23, 2019 · 24 comments

Comments

@ctron
Copy link

ctron commented Aug 23, 2019

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

@ctron
Copy link
Author

ctron commented Aug 23, 2019

Rolling back to "CLion 2019.2", having the same Rust plugin version, seems to fix the issue.

@lovasoa
Copy link

lovasoa commented Aug 26, 2019

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

@vlad20012
Copy link
Member

vlad20012 commented Aug 27, 2019

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

@ctron
Copy link
Author

ctron commented Aug 27, 2019

So I re-upgraded to "2019.2.1" and the problem was no longer present.

I still "invalidated caches" … which fixed a few "missing references" I had after starting.

@SvetlinZarev
Copy link

SvetlinZarev commented Nov 12, 2019

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

@Undin
Copy link
Member

Undin commented Nov 14, 2019

@SvetlinZarev it seems different issues
The reason of your case is described in #4627 (comment)

@jamestack
Copy link

I have encountered the problem with @SvetlinZarev today.

  1. add "futures 0.3.1 && async-std 1.0.1" to Cargo.toml
  2. move mouse point to async_std::net::ToSocketAddrs show box " Unresolved reference 'ToSocketAddrs' "
  3. open "External Libraraies/async-std 1.0.1/src/net/addr.rs" show "File is not included in module tree, analysis is not available"
  4. cargo clean not work.
  5. rm .idea -rf not work.
  6. and click "Invalidate Caches / Restart" not work too.
    My IDEA and all-plugin is also up to date.

@Undin
Copy link
Member

Undin commented Nov 15, 2019

  1. cargo clean not work.
  2. rm .idea -rf not work.
  3. and click "Invalidate Caches / Restart" not work too.

@JamesWone All these steps are not relevant to your problem because the initial issue and your one differ. At this moment, there is no workaround to fix it

@stianeklund
Copy link

stianeklund commented Nov 22, 2019

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.

@jcollum
Copy link

jcollum commented Dec 30, 2019

@stianeklund 2nded: deleting .idea folder does not help.

@CoolOppo
Copy link

CoolOppo commented Jan 9, 2020

Happening for me as well. The project it's happening to me with is async-std. Deleting the .idea folder and invalidating the cache didn't work either.

@Undin
Copy link
Member

Undin commented Jan 10, 2020

@CoolOppo See #4627

@adamnemecek
Copy link

I'm not sure this will help anyone but it appears that in my case, I was seeing this due to misunderstanding how CLion parses the packages.

If you are seeing this problem with nested crates, you need to include your nested crates in the top level lib.rs/main.rs. CLion I guess only analyzes crates that are included and ignores the nested crates so you have to include them.

@Undin
Copy link
Member

Undin commented Feb 18, 2020

@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

@adamnemecek
Copy link

Ok sure but things seem to work when I do. Like this is probably a better solution anyway since it's version controlled and such.

@JohnnyJayJay
Copy link

JohnnyJayJay commented Apr 9, 2020

This issue also happens in IntelliJ 2019.3.4 for me, without any dependency or nested crates. All the previous attempts like deleting .idea, invalidating the caches and so on have not worked for me either.

Are there any updates on this, is there a solution?

Edit: Disregard this. I'm fairly new to rust and simply forgot to add the file as a module x)

@166MMX
Copy link

166MMX commented Apr 9, 2020

This issue also happens in IntelliJ 2019.3.4 for me, without any dependency or nested crates. All the previous attempts like deleting .idea, invalidating the caches and so on have not worked for me either.

Are there any updates on this, is there a solution?

Edit: Disregard this. I'm fairly new to rust and simply forgot to add the file as a module x)

@JohnnyJayJay please be so kind and explain how you added the file to module x

I am still struggling with this. And am not sure what I forgot.

@JohnnyJayJay
Copy link

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

@166MMX
Copy link

166MMX commented Apr 9, 2020

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

@JohnnyJayJay Thanks a ton! It solved it for me.

Though after so adding the mod name; declaration to my lib.rs it yield a redeclaration warning. The reason for that was that I also had that module implemented within lib.rs. Now I just had to move the implementation to the the other file. But after cleanup and moving the code it's not complaining anymore.

I guess I was holding it wrong too, oops.

@steelx
Copy link

steelx commented May 4, 2020

this doesnt work if you are solving rustlings exercise.
image

@SoumenDass
Copy link

Same issue when I open Rust exercises downloaded from exercism e.g. the Prime Factors exercise.

image

@vlad20012
Copy link
Member

If someone runs into this nowadays, please, file a new separate issue.

@lockieluke
Copy link

lockieluke commented Apr 5, 2021

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

@nojitsi
Copy link

nojitsi commented Jan 28, 2023

Make sure there is no space in project path.
Moving directory to new path without spaces fixed issue for me.

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