Question
Why are file extensions and default Java icon not visible in the Project tool window for Java files?
Some users expect this:
but actually see this:
Answer
Short answer:
- By default, Java coffee cup icons are replaced with type-specific ones (for class, interface, etc.)
- File extensions are hidden by design. See technical explanation of the current design and its limitations. We are looking into possible implementation options for this feature in this YouTrack ticket.
More details:
Java file extensions (and the default coffee cup icon) are only visible when the IDE does not know that it is looking at production code, which happens when the corresponding content root (e.g., src) is not marked as Sources (blue folder).
When a Java project is configured correctly, its source code folder is blue, and the IDE knows that there are compilable .java files inside. To minimize visual clutter, it was decided to hide the extension of all Java files in that folder by default and show a corresponding icon (for class, interface, etc.) instead of the coffee cup.
Workaround
At the moment, there is no official switch to show or hide the .java extension in Project view (feature request to upvote, also technical explanation). However, you can use the following steps to show it temporarily if you need:
- Right-click on the blue source directory (e.g.,
main) - Mark Directory As -> Unmark as Sources Root
⚠️ Don't forget to repeat the steps to mark the directory as Sources Root again to prevent compilation issues.
Result:
Related feature request
IJPL-51499 Project Tool Window: add view to always display files with the extension
Comments
0 comments
Please sign in to leave a comment.