Why is my file marked in red?
Answered
I have a java class that is marked in red in project view, but Idea shows no errors in the main view. Is there any way to find out what Idea is complaining about?
Please sign in to leave a comment.
If you are referring to the file name being in red, that indicates there was a Version Control System (VCS) merge conflict (or the file was changed as part of two different change lists and has not yet been acknowledged). More info is available in the Help on the page: IntelliJ IDEA | Reference | Version Control Reference | File Status Highlights
As an FYI, if the file contained errors, it would be notated with a red wavy underline. The color of the file name indicates its VCS status.
I meant it had wavy lines underneath the file name in the project view, as if the file had syntax errors. I did not see any errors in the file editor. This is an area where I think Eclipse (yipes!) has a nice feature in the "Errors" view, which allows you to see all the errors in the project. I don't see an equivalent in IntelliJ. "Messages" is close, but does not show all errors that Idea detects.
I'm not familiar with Eclipse, so I am not sure if this is exactly what you are looking for, but in Idea you can view all the files that have errors. In the Project Tool Window, change the "View As" selection to a Scope of "Problems". This will show a list of all files that have errors. It does not show the individual error within each file. For that you need to open the file.
If you want to view a list of all errors in the project, from the menu select Analyze | Inspect Code... Select an Inspection Profile. After you run the inspection, you will get an Inspection Tool window on the bottom that will give a detailed report of all the problems found. In this window you can group the problems by severity (error, warning, etc). You can also group by directory, although they are still broken down by error type at a top level. I do not believe there is a way to group by file at the top level. You may want to enter a feature request to allow such to be done (see http://youtrack.jetbrains.net) if this is something you desire. Also note that you can run batch/bulk fixes for many of them. Sometimes it can be useful to create an alternate inspection profile for when you run inspections (limiting the ones run for example). There is the one time investment of creating such a profile; but it can be useful.
If your file is showing a red wavy line, but you are not seeing any errors shown in the right gutter when you open the file, you can try the following. Make a change in the file to force a re-inspection. If that does not work, there may be a corrupt cache in your project. It doesn't happen often, but sometimes it does. Use the File | Invalidate Caches option. Then restart IDEA (it will need to re-index your project on startup.) If that does not resolve the issue, or if the issue returns frequently, open a bug report at http://youtrack.jetbrains.net.
Thank you. This helped:
I changed the source of my project files, maven project. Now the file names are not in red color.
Before change source. I don't know why?