# Scope language syntax reference

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com.cn/en-us/help/go/llms.txt).

You can use the scopes language to specify project [scopes](configuring-scopes-and-file-colors.html): sets of files, directories, and subdirectories.

## Sets of files

* To add a single file, use a filename (for example, `MyDir/MyFile.txt`)

* To add all the files in a directory without subdirectories, use an asterisk after a slash (for example: `file:src/main/myDir/*`)

* To add all the files in a directory with subdirectories, use an asterisk after a double slash (for example, `file:src/main/myDir//*`)

## Logical operators

When you define scopes, you can use logical operators:

```
&& for AND
|| for OR
! for NOT
```

Also, you can use parentheses to join logical operators into groups. For example, the following scope includes either <a> and <c>, or <b> and <c>:

```
(<a>||<b>)&&<c>
```

## Create a new scope from existing scopes

You can make a new scope from several existing scopes. In this case, you can reference the existing scopes by using `$` `$MyScope`.

For example, the `$Scope1||$Scope2` pattern places in a scope all files from `Scope1` and `Scope2`.

## Defining scopes

Scopes are defined in the [Scopes](settings-scopes.html) dialog in the following ways:

Manually
: In the Pattern field, specify file masks. Alternatively, click the Expand button (                        ![the Expand button](https://resources.jetbrains.com.cn/help/img/idea/2026.3/app-client.general.expandComponent.svg)) and type the pattern in the editor.

Using the Mouse Pointer
: In the tree view, select files and directories. To include or exclude files and directories, use the following buttons: Include, Include Recursively, Exclude, and Exclude Recursively. For more information about the buttons, refer to [Define a new
: scope](configuring-scopes-and-file-colors.html#creating-a-new-custom-scope).
:
:
:
: When you click the buttons, GoLand creates an expression and displays it in the Pattern field.

## Examples

| Description | Pattern | Example |
| --- | --- | --- |
| Include a single file by its name | `file:<directory>/<file>` | `file:databases/create_schema.sql` |
| Include a set of all files in a directory, without subdirectories | `file:<directory>/*` | `file:databases/mysql-db/*` |
| Include a set of all files in a directory with subdirectories | `file:<directory>//*` | `file:databases/mysql-db//*` |
| Include a file by its name from the certain project | `file[project_name]:<directory>/<file>` | `file[default]:databases/create_schema.sql` |
| Possible logical operators &&·(AND), \|\|·(OR), !·(NOT). | `file[project_name]:<directory>&&!file:<directory>` | `file[default]:databases/*&&!file:databases/create_schema.sql` |

## See also

### Reference

[Scopes](settings-scopes.html)

### Procedures

[Scopes and file colors](configuring-scopes-and-file-colors.html)

