Okay, so you're deep down and away in your project, when you notice that the project files in PhpStorm has been "yellowed out". What the 🤬 ...
The background yellow indicates that the files are not part of your project. However, a minute ago everything was part of the project, so what happened?
On top of the yellow files fever, the Directories section in the settings is completely blank. Usually you would be able to add any directory to your project from here. But nope, not now.
After reading a dozen of StackOverflows from people who had more or less the same symptoms, my conclusion was:
.idea
folder and restart againAnd yes, this worked. But - gone were your project settings, tasks, etc - so I had to find a better solution.
After a few more yellow incidents, I found out that this happened during a merge.
I posted a desperate cry for help at the Jetbrains community - and Andriy pointed me in the right direction. He wrote:
The project config gets broken for whatever reason.
Ahh! So a git merge corrupts the config!
He advised me not to have the .idea folder under version control. I double checked - but no, it wasn't: The whole folder was ignored.
But - the branch that I merged from, still contained some .idea files from the project start!
This was the problem. This messed up the configs.
I was now able to recreate the problem - and this led me to locate the exact spot in .idea/modules.xml
with an invalid path.
I fixed it by updating with a valid link to the .iml file:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/path/to/iml" filepath="$PROJECT_DIR$/.idea/path/to/iml" />
</modules>
</component>
</project>
And - of course - I made sure that none of my other branches had any .idea
leftovers.
Voila! Goodbye yellow background pane! 👋
Shouldn't your excellent IDE warn you, if something messes up a config file? Like when a merge causes an invalid path to an .iml file?
Hellooo JetBrains guys, anyone out there?? 😁