IntelliJ IDEA
 
2024.3
Get IntelliJ IDEA

Scopes and file colors

Last modified: 18 December 2024

A scope the Scope icon is a group of files, packages, and folders in a project. You can use scopes to visually distinguish project items in different IDE views and to limit the range of specific operations.

Scopes are designed to logically organize files in your project: test sources can go to the test-related scope, and production code can be associated with the scope of production files. These logical chunks make your project easier to manage. For example, running test-related inspections only in test classes takes less time than if you run them in all files in your application.

IntelliJ IDEA comes with a set of predefined scopes, but you can also create custom scopes. There, you can include any files and folders. For example, a custom scope can include only those files in the project for which you are responsible.

In IntelliJ IDEA, scopes are used in code inspections, some refactorings, search, in copyright settings, in various features for code analysis, and so on.

There are 2 types of scopes: local and shared.

  • Local scopes are stored in the IDE configuration directory, that is why they are not shared through VCS and are not available to other members of your team.

  • Shared scopes are added to a VCS so that people who work on a project can use the same scopes. These scopes are stored together with the project in the scopes folder under .idea. Each scope is saved as a file with the .xml extension (for example: MyProject/.idea/scopes/shared-scope.xml).

Using shared scopes makes sense if your project is under version control. If you don't use a VCS, local scopes will be sufficient to cover your needs.