# Sandbox.UI.ScriptControl

A reusable script editor with completion, quick info, parameter help and diagnostics.
Analysis uses Game.Scripting and never executes the source. All public source offsets are UTF-16.

- Kind: class
- Namespace: `Sandbox.UI`
- Assembly: `Sandbox.Engine`
- Inherits: [Sandbox.UI.Panel](/api/Sandbox.UI.Panel)

## Constructors

- [`ScriptControl`](/api/Sandbox.UI.ScriptControl/.ctor)

## Properties

- [`Analysis`](/api/Sandbox.UI.ScriptControl/Analysis): The current immutable metadata snapshot, updated immediately when the source or inputs change.
- [`CanRedo`](/api/Sandbox.UI.ScriptControl/CanRedo): Whether an undone edit is available to redo.
- [`CanUndo`](/api/Sandbox.UI.ScriptControl/CanUndo): Whether an edit is available to undo.
- [`CaretOffset`](/api/Sandbox.UI.ScriptControl/CaretOffset): Caret position measured in UTF-16 source units.
- [`Column`](/api/Sandbox.UI.ScriptControl/Column): One-based text-element column at the caret.
- [`CompletionVisible`](/api/Sandbox.UI.ScriptControl/CompletionVisible): Whether the completion list is open.
- [`DiagnosticDelay`](/api/Sandbox.UI.ScriptControl/DiagnosticDelay): Seconds of idle time before showing diagnostics. Highlighting stays immediate.
- [`Diagnostics`](/api/Sandbox.UI.ScriptControl/Diagnostics): Diagnostics from the current analysis, including those waiting for the display delay.
- [`Inputs`](/api/Sandbox.UI.ScriptControl/Inputs): Typed external inputs made available to script analysis.
- [`Line`](/api/Sandbox.UI.ScriptControl/Line): One-based line number at the caret.
- [`OnDiagnosticsChanged`](/api/Sandbox.UI.ScriptControl/OnDiagnosticsChanged): Called when analysis produces a new diagnostic snapshot, before the display delay.
- [`OnSourceChanged`](/api/Sandbox.UI.ScriptControl/OnSourceChanged): Called immediately when the source text changes, including IME previews.
- [`ReadOnly`](/api/Sandbox.UI.ScriptControl/ReadOnly): Allow selection and navigation while preventing edits.
- [`ShowStatusBar`](/api/Sandbox.UI.ScriptControl/ShowStatusBar): Show the optional status bar beneath the editor.
- [`Source`](/api/Sandbox.UI.ScriptControl/Source): Source code. Replacing the document clears its undo history.
- [`TabSize`](/api/Sandbox.UI.ScriptControl/TabSize): Number of spaces inserted for a tab, clamped to one through eight.
- [`Theme`](/api/Sandbox.UI.ScriptControl/Theme): Colors used by this editor. Assigning a new theme updates existing text and popups without changing the document, selection or undo history.

## Methods

- [`AcceptCompletion`](/api/Sandbox.UI.ScriptControl/AcceptCompletion): Replace the current completion range with the selected suggestion as an undoable edit.
- [`DismissIntelliSense`](/api/Sandbox.UI.ScriptControl/DismissIntelliSense): Close completion, parameter help and hover documentation.
- [`FocusEditor`](/api/Sandbox.UI.ScriptControl/FocusEditor): Give keyboard focus to the text editor.
- [`GoToDiagnostic`](/api/Sandbox.UI.ScriptControl/GoToDiagnostic): Move to the next diagnostic (F8), or the previous one (Shift+F8).
- [`InsertText`](/api/Sandbox.UI.ScriptControl/InsertText): Insert text at the selection as one undoable edit.
- [`OnDeleted`](/api/Sandbox.UI.ScriptControl/OnDeleted)
- [`Redo`](/api/Sandbox.UI.ScriptControl/Redo): Reapply the last undone edit and close IntelliSense.
- [`RefreshAnalysis`](/api/Sandbox.UI.ScriptControl/RefreshAnalysis): Immediately recreate analysis after input metadata or scripting permissions change.
- [`Select`](/api/Sandbox.UI.ScriptControl/Select): Select a range of source code, measured in UTF-16 units.
- [`ShowCompletions`](/api/Sandbox.UI.ScriptControl/ShowCompletions): Open permitted completions for the current caret. Ctrl+Space invokes this.
- [`ShowQuickInfo`](/api/Sandbox.UI.ScriptControl/ShowQuickInfo): Display symbol documentation or a diagnostic at a UTF-16 source offset.
- [`Tick`](/api/Sandbox.UI.ScriptControl/Tick)
- [`Undo`](/api/Sandbox.UI.ScriptControl/Undo): Undo the last edit and close IntelliSense.
