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 ( ) 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:*.sqlpattern 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.
Executable SQL files that are attached to a specific data source.
Consider the following figure that shows locations of these elements.