Today after an update to PyCharm 2021.2.2 I found that some projects in my workspace were messed up, for example I see this:
Instead of this, that I was seeing before PyCharm update:
Is there any way to fix this?
(Answering my own question so as to save time for users facing the same issue.)
EDIT: found a more stable and faster solution.
In PyCharm > Settings > Project Structure, select the project and remove the useless "Content Roots" at the right on the screen.
Old solution for reference:
<root>/.idea/<project>.iml
and remove all XML entries that refer to content outside the project: