> For the complete documentation index, see [llms.txt](https://docs.servoy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.servoy.com/reference/servoy-developer/solution-explorer/all-solutions/active-solution/scopes/scope.md).

# Scope

Reference documentation for individual Scope items in the Solution Explorer

## 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
