# Scope

## Overview

In Servoy, a scope is a JavaScript execution context within the solution, containing variables and functions.\
Expanding a scope will show the following:

* [variables](/reference/servoy-developer/solution-explorer/all-solutions/active-solution/scopes/scope/variables.md#overview)
* relations: by right-clicking on this item, the user has the option to create a relation through [relation editor](/reference/servoy-developer/object-editors/relation-editor.md).

## Commands Summary

A summary of commands available on this item via right-click context menu:

| Command                                         | Summary                                                                                            |
| ----------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| [Open in Script Editor](#open-in-script-editor) | Opens the scope in [Script Editor](/reference/servoy-developer/object-editors/scripting-editor.md) |
| [Create method](#create-method)                 | Creates a new method in global scope                                                               |
| [Delete scope](#delete-scope)                   | Deletes the global scope                                                                           |
| [Rename scope](#rename-scope)                   | Gives a new name to the scope                                                                      |
| [Run JSUnit tests](#run-jsunit-tests)           | Runs JSUnit tests from a global scope                                                              |

## Commands Details

The details for each command available on this item via right-click context menu

### Open in Script Editor

Opens the scope in [Script Editor](/reference/servoy-developer/object-editors/scripting-editor.md). A scope is just a javascript file in the workspace.

### Create method

Creates a javascript method in the scope.

### Delete scope

Deletes the global scope (deletes scope javascript file from workspace).

### Rename scope

You can choose a new name for your global scope. This will NOT change all occurrences of old name, will only modify the scope itself to the new name.

{% hint style="warning" %}
Warning\
Use with care.
{% endhint %}

### Run JSUnit tests

Runs JSUnit tests from your scope. See [Unit Testing](/reference/servoy-developer/object-editors/scripting-editor/unit-tests.md) for what is unit testing and [JSUnit API](/reference/servoycore/dev-api/jsunit.md) for JSUnit testing API.

## Contextual List

Here are the item details that appear in the [contextual list](https://github.com/Servoy/gitbook/blob/master/reference/servoy-developer/solution-explorer/all-solutions/active-solution/scopes/solution-explorer-contextual-list.md#overview) and each command available via right-click:

* method:
  * [Move Code](/reference/servoy-developer/solution-explorer/solution-explorer-contextual-list.md#move-code)
  * [Open in Script Editor](/reference/servoy-developer/solution-explorer/solution-explorer-contextual-list.md#open-in-script-editor)
  * [Debug Method](/reference/servoy-developer/solution-explorer/solution-explorer-contextual-list.md#debug-method)
  * [Search for References](/reference/servoy-developer/solution-explorer/solution-explorer-contextual-list.md#search-for-references)
  * [Create method](/reference/servoy-developer/solution-explorer/solution-explorer-contextual-list.md#create-method)
  * [Delete method](/reference/servoy-developer/solution-explorer/solution-explorer-contextual-list.md#delete-method)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.servoy.com/reference/servoy-developer/solution-explorer/all-solutions/active-solution/scopes/scope.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
