<html><head><link rel="canonical" href="https://www.jetbrains.com/help/idea/scope-language-syntax-reference.html.md/" data-react-helmet="true"/></head><body># Scope language syntax reference

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

## Sets of classes

* Single class is defined by a class name, for example: `com.intellij.openapi.MyClass`

* Set of all classes in a package, not recusing into subpackages, is defined by an asterisk after dot, for example: `com.intellij.openapi.*`

* Set of all classes in a package including contents of subpackages, is defined by an asterisk after double dot, for example `com.intellij.openapi..*`

## 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//*`)

## Modifiers

### Location modifiers

Location modifiers help you specify location of the necessary file:

* `src:` – for source files

* `lib:` – for library classes

* `test:` – for test code

For example, the `src:com.intellij.openapi.*` pattern places in a scope all classes under the source root in the `com.intellij.openapi` package, excluding subpackages. The default location is the module root.

### Module modifiers

Module modifiers help you narrow down the scope by specifying the name of the related module:

* `src[module name]:<e>`

* `lib[module name]:<e>`

* `test[module name]:<e>`

For example, the `src[MyModule]:com.intellij.openapi.*` pattern places in a scope all classes under the source folders related to the `MyModule` module in the `com.intellij.openapi` package, excluding subpackages.

## Logical operators

When you define scopes, you can use logical operators:

```
&amp;&amp; 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>:

```
(</c></b></c></a><b><a>||<b>)&amp;&amp;<c>
```

Another example

```
file[*web*]:src/main/java//*
```

denotes a scope of all modules whose name contains `web`, and all the files recursively in the directory `src/main/java`.

## 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`.

## Examples

* `file[MyMod]:src/main/java/com/example/my_package//*` – include in a project all the files from module "MyMod", located in the specified directory and all subdirectories.

* `src[MyMod]:com.example.my_package..*` - recursively include all classes in a package in the source directories of the module.

* `lib:com.company..*||com.company..*` - recursively include all classes in a package from both project and libraries.

* `test:com.company.*` - include all test classes in a package, but not in subpackages.

* `[MyMod]:com.company.util.*` - include all classes and test classes in the package of the specified module.

* `file:*.js||file:*.coffee` - include all JavaScript and CoffeeScript files.

* `file:*js&amp;&amp;!file:*.min.*` - include all JavaScript files except those that were generated through minification, which is indicated by the `min` extension. Learn more from [Minifying JavaScript](minifying-javascript.html).

* `!file:*/.npm//*` - exclude all `.npm` folders.

## See also

### Reference

[Scopes](settings-scopes.html)

### Procedures

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

</c></b></a></b></e></e></e></body></html>