CLion 2017.3 Help

Scope

Basics

A scope() is a subset of files, and/or directories in your project, to which you can limit the application of specific operations, e.g. search, code inspection, etc. Besides, you can configure coloring for each scope to see at once what sort of file you are dealing with.

Scopes get more helpful as your project grows larger. There is a number of predefined scopes that cover basic cases. Additionally, it is possible to add custom scopes to your project. For example, you can create custom scopes for tests or for the files you are responsible for in your team.

Types of scopes

Scopes can be either shared or local:

Shared scopes are accessible for the team members via VCS and are stored at the project level. in the scopes directory under .idea, as a file with the extension xml, i.e. .idea/scopes/<scope_name>.xml.

Local scopes are intended for personal use only and are stored in your workspace in the file workspace.xml under .idea.

By selecting files and folders and clicking the buttons Include, Include Recursively, Exclude, and Exclude Recursively. Based on the inclusion/exclusion, CLion creates an expression and displays it in the Pattern.

To view the available scopes, click the (next to the Project header of the Project Tool Window.

Scopes coloring

Files belonging to different scopes can be highlighted in different colors throughout the CLion's user interface: in navigation lists, in the editor tabs, in the Project Tool Window. This allows much faster and easier navigation in large projects.

If some file is included into several scopes, the order of the scopes becomes important: CLion uses the color of the uppermost scope (shown in the Scopes settings page) to highlight such file. Of course, you can change the order of the scopes, and thus the resulted highlighting.

Project Production Files. This scope is similar to the Project Files scope. The difference is that the test source roots are not included. In the Project Tool Window, this scope corresponds to the scope view Production.

Project Test Files. This scope is limited to the project test source roots. In the Project Tool Window, this scope corresponds to the scope view Tests.

Non-Project Files. This scope is available only as a view in the Project Tool Window. It is limited to libraries and SDKs.

Changed Files. This scope corresponds to all changed files, that is, ones associated with all existing changelists.

Default. This scope corresponds to the files associated with the changelistDefault.

Open files.This scope corresponds to the files opened in CLion editor.

Current file. This scope corresponds to the file currently active in CLion editor.

Selected files. This scope corresponds to the files currently selected in CLion (e.g. in the Project Tool Window).