DataGrip 2022.1 Help

How to differentiate between a scope, a scratch file, and a query console

Scopes, scratch files, and consoles are basic tools that provide comfortable interaction with a source code for users. With these tools, you can quickly switch views, create workspaces with files of a certain type, have drafts and notes for your code ideas, and execute your code.

The Files tool window (View | Tool Windows | Files) includes two views: Scopes and Files. The view means a set or a subset of files and directories that DataGrip indexes to perform code inspection and search operations. The Files view is a default view.

  • The Files view displays all directories and files that are used in the project: attached directories, scratch files, console files, and extensions.

  • The Scopes view displays a subset of filtered files, packages, or directories in your project (for example, the file:*.sql pattern includes only SQL files in the created scope). You can configure filters for the Scope view.

To run your code statements and keep track of your code ideas, use two special file types: scratches and consoles.




Files that are not attached to a specific data source.

  • A temporary note or a draft for your code outside the project context.

  • By default, scratch files are not attached to a data source.


Executable SQL files that are attached to a specific data source.

  • File that you can use to compose and execute SQL statements in the project context.

  • Console files are attached to a data source.

Consider the following figure that shows locations of these elements.

Differences between scopes scratches and files
Last modified: 07 April 2022