Search code examples
javafileintellij-ideaidecorrupt

IntelliJ project files suddenly broken


I've been working on a project in IntelliJ IDEA for about two months now. Today, when I fired up the IDE, which would usually open project straight up, IntelliJ took unusually long time to load, and when it did open the project, the main .java file displayed a long line of spaces and nothing else, instead of the code that was there before. The .iml file, the only other thing in the project, was fine. An error message was on the top:

"This document contains very long lines. Soft wraps were forcibly enabled to improve editor performance."

Trying to edit the document results in the entire program freezing and becoming unresponsive. What the hell happened? It was fine one day and then just did this, how do I get my project back and how do I prevent this?


Solution

  • Solved in the comments below the question; thought I might as well post a dummy answer and mark this as resolved.

    EDIT: Solution written out.

    1. Right click on file > Local History > Show History

    2. Find any suspicious changes in the list on the left. Be especially on lookout for "External changes", as those can indicate crashes and sudden power-outs. Alternatively, look for times when you remember your computer crashed or power went out while IntelliJ was open.

    3. Revert the changes(curved purple arrow in the upper left corner). Restart the IDE if it's going slow. Everything should work properly now.