Project view not showing directories

Somehow the Project view is not showing the directories for my Project?  It's as though it's treating the build.xml as the 'root' of the project and I'm not able to browse directories as I usually can.  I've tried invalidating the caches and restarting, no help.  Problem is not present for any of my other projects.



Attachment(s):
Screen shot 2011-12-20 at 11.22.52.png
8
42 comments

I think I found a simple solution that seems to work for me in PHPStorm. Yes, you can switch to the "Project Files" view, but that does not solve the problem of namespaces not being properly detected and "class not found" inspections in the IDE.  I tried invalidating the cache and restarting but that did not seem to help. I did not want to delete the .idea directory. On a whim, I tried closing the project via the "File-->Close Project" menu and re-opening it. This worked for me after all other methods failed. I didn't even have to restart the IDE. So, apparently manually closing and re-opening the project without restarting the IDE does something different than simply closing the window and restarting the IDE. 

29

Switch to "Project Files" view instead of "Project" view. Done.!!!

14

What worked for me is that I closed the project from the "File" menu, then delete the .idea/ folder from command line and then open the project again.

13

Check your idea.log -- it may have some details explaining why or what is happening (Help | Reveal log in Explorer). Possibly one of the config files got corrupted.

You can always backup and delete .idea subfolder (project settings) and re-create project from scratch. When it's wroking again (after basic configuration) you may copy some of the files from that folder back to recover some of your settings (if there were many).

11

Thanks, I didn't have to many settings, and deleting .idea then recreating the project has solved the problem.

8

Switch to "Project Files" view instead of "Project" view

Worked for this newb

6

So, I see what is gong wrong, and I now have a good understanding why. The problem is that the .idea folder is best not committed to git/version-control as it differs per developer/system. My tip to all is to ignore the folder, but more importantly untrack the folder as well. Switching to branches which still have this folder tracked, can bring problems as you will be switching .idea folder to other developers and older states (losing for example run configurations).

(I think my problem still arises for because my master branch still contains the .idea folder, so I have to release/PR to master to untrack it and it will be fixed.)

How to fix it:
1) Add .idea or **/.idea to .gitignore

**/.idea
... other ignores


2) And untrack the folder (adjust the path to your situation). Make sure to commit/push and PR/merge/release the result to any afflicted branches.

git rm -r --cached .idea
4

The issue still persists for me using WebStorm.

Here's a list of proposed solutions from this thread that don't work for me:

  • Doing a "File > Close Project" and "Open Recent"
  • Quit and Restart doesn't work
  • Tell git to ignore the .idea/ folder (it's not tracked in the project)

The only thing that works is to delete the .idea/ folder and start fresh.

WebStorm 2021.1.2
Build #WS-211.7442.26, built on May 24, 2021
Runtime version: 11.0.11+9-b1341.57 x86_64
VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.7

3

Further to this, the Project preferences for Directories won't load to show which directory the project points to.  See attached.



Attachment(s):
Screen shot 2011-12-20 at 11.40.01 (2).png
2

Thanks, deleting the .idea directory worked for me. After that all the folder showed up again.

2

@Leo

No idea. That delete option was offered as hard workaround for one time issue.

If it happens to you all the time.. then it must be something else and needs investigation. Contact Support Team by making Support Request -- use "Submit a Request" link at the top of this page.

2

To view all folders in explorer project view...
File -> Settings

Version Control -> Directories

Add content root to project root folder. All folders will appear in project

2

Issue still persists in PHPStorm 2020.2.

No directories found, Settings > Directories is empty ("nothing to show").

Deleting the .idea/workspace.xml file did the job for me. The re-created workspace.xml did not show any significant differences - however, re-creating the file also created a .idea/<project>.iml file which was missing before. So I suppose that's might be the core of the problem. Also, the inspectionProfiles folder was created after that, but I suppose that is just because previously my source folders were not available for indexing.

2

Brett Brewer, thank you! Your simple solution helped me! For me - the same issue appears in my IntelliJ IDEA Ultimate 2020.3.

2

@D J Zwart

You can share the .idea in VCS if that makes sense/brings benefits for your team. Just not the whole folder: some dev-specific files need to be excluded. Check the link below for some general info:

https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

2

Is that it? No way to force reindex the project folder ... so every time I add a new folder I have to close the project, delete .idea then open the project again ??

1

Thanks, deleting the .idea directory worked for me too.

1

You're definitely right, Brett. Thank you!)

1

Brett Brewer's solution worked for me as well! Thank you.

1

I had this issue with two projects. Neither Oliver's nor Brett's solution didn't work in my case. Invalidating the caches and restarting did not work, either. Deleting the `.idea` directory fixed the issue on the first project, but found a simpler solution with the second one:

  • Update the paths in `idea/modules.xml`

 

 

1

Vireyes14

Thank you, that worked for me unlike other solutions

1

What worked for me:

1. Close project

2. Then delete whole .idea directory

3. Open project again

Now Webstorm shows me file in Project correctly. Thanks everyone for help! 

1

File -> Settings

"Project Structure" under Project

On the right hand side you will see all your projects

Now select the hidden project, then "Add Content Root"

Select the root folder of your project

Save

All projects should now appear properly

1

I had a browse around settings when this happens. Most frequently it happens when I load the same project up in different jetbrains tools (pycharm, clion, intellij etc) which is common for me as I do a lot of mixed work on the same repo.

I noticed that when my files vanish from the "Project" view that it appears the IDE thinks the project has no root folders.

If I go into the Settings -> Project -> Project Structure dialog, sure enough there are no roots.  If I set my root folder back up as normal things start working again.

Looking at the files that change between having no root and adding it back.  The project ".iml" file has one difference:

<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.8 (nsbt)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

Broken projects seem to be missing the `<content url="file://$MODULE_DIR$" />` element from <component>

1

Though, sorry, I didn't check the log before I deleted it... :( If it happens again I will do and report back findings if that would help.

0

If you still facing this issue, check that your path to the project doesn't contain special characters. Because in my case, there was a folder "\...more!\" and in Settings>Directories content root was "\...more\!\". 

0

Banehallow unless spaces are considered special characters, this cannot be the reason in my case.

Brett Brewer got it right, that's the most simple workaround. However, this is only a workaround and still a bug that should be addressed.

0

Brett Brewer you're lifesaver, man!

0

Please sign in to leave a comment.