API ReferenceSandbox.UI

ScriptControlclass

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.

object→Panel→ScriptControl
Namespace
Sandbox.UI
Assembly
Sandbox.Engine
Declaration
public class Sandbox.UI.ScriptControl : Sandbox.UI.Panel

Constructors1

Showing 1 constructors

Methods13

Showing 13 methods

public void AcceptCompletion()PUBLIC

Replace the current completion range with the selected suggestion as an undoable edit.

Returns:void—

public void DismissIntelliSense()PUBLIC

Close completion, parameter help and hover documentation.

Returns:void—

public void FocusEditor()PUBLIC

Give keyboard focus to the text editor.

Returns:void—

public void GoToDiagnostic(bool previous = False)PUBLIC

Move to the next diagnostic (F8), or the previous one (Shift+F8).

ParameterTypeDescription
previous = Falsebool—
Returns:void—

public void InsertText(string text)PUBLIC

Insert text at the selection as one undoable edit.

ParameterTypeDescription
textstring—
Returns:void—

public virtual void OnDeleted()PUBLICVIRTUAL

Returns:void—

public void Redo()PUBLIC

Reapply the last undone edit and close IntelliSense.

Returns:void—

public void RefreshAnalysis()PUBLIC

Immediately recreate analysis after input metadata or scripting permissions change.

Returns:void—

public void Select(int start, int length)PUBLIC

Select a range of source code, measured in UTF-16 units.

ParameterTypeDescription
startint—
lengthint—
Returns:void—

public void ShowCompletions(bool explicitRequest = True)PUBLIC

Open permitted completions for the current caret. Ctrl+Space invokes this.

ParameterTypeDescription
explicitRequest = Truebool—
Returns:void—

public void ShowQuickInfo(int offset)PUBLIC

Display symbol documentation or a diagnostic at a UTF-16 source offset.

ParameterTypeDescription
offsetint—
Returns:void—

public virtual void Tick()PUBLICVIRTUAL

Returns:void—

public void Undo()PUBLIC

Undo the last edit and close IntelliSense.

Returns:void—

Properties17

Showing 17 properties

public bool Sandbox.UI.ScriptControl.CanRedo { get; set; }PUBLICGETSET

Whether an undone edit is available to redo.

Returns:bool—

public bool Sandbox.UI.ScriptControl.CanUndo { get; set; }PUBLICGETSET

Whether an edit is available to undo.

Returns:bool—

public int Sandbox.UI.ScriptControl.CaretOffset { get; set; }PUBLICGETSET

Caret position measured in UTF-16 source units.

Returns:int—

public int Sandbox.UI.ScriptControl.Column { get; set; }PUBLICGETSET

One-based text-element column at the caret.

Returns:int—

public bool Sandbox.UI.ScriptControl.CompletionVisible { get; set; }PUBLICGETSET

Whether the completion list is open.

Returns:bool—

public float Sandbox.UI.ScriptControl.DiagnosticDelay { get; set; }PUBLICGETSET

Seconds of idle time before showing diagnostics. Highlighting stays immediate.

Returns:float—

public System.Collections.Generic.IReadOnlyList`1<Sandbox.Script.Diagnostic> Sandbox.UI.ScriptControl.Diagnostics { get; set; }PUBLICGETSET

Diagnostics from the current analysis, including those waiting for the display delay.

Returns:IReadOnlyList<Diagnostic>—

public System.Collections.Generic.IReadOnlyList`1<Sandbox.Script.Input> Sandbox.UI.ScriptControl.Inputs { get; set; }PUBLICGETSETINGEST

Typed external inputs made available to script analysis.

Returns:IReadOnlyList<Input>—

public int Sandbox.UI.ScriptControl.Line { get; set; }PUBLICGETSET

One-based line number at the caret.

Returns:int—

public System.Action`1<System.Collections.Generic.IReadOnlyList`1<Sandbox.Script.Diagnostic>> Sandbox.UI.ScriptControl.OnDiagnosticsChanged { get; set; }PUBLICGETSET

Called when analysis produces a new diagnostic snapshot, before the display delay.

Returns:Action<IReadOnlyList<Diagnostic>>—

public System.Action`1<string> Sandbox.UI.ScriptControl.OnSourceChanged { get; set; }PUBLICGETSET

Called immediately when the source text changes, including IME previews.

Returns:Action<string>—

public bool Sandbox.UI.ScriptControl.ReadOnly { get; set; }PUBLICGETSET

Allow selection and navigation while preventing edits.

Returns:bool—

public bool Sandbox.UI.ScriptControl.ShowStatusBar { get; set; }PUBLICGETSET

Show the optional status bar beneath the editor.

Returns:bool—

public string Sandbox.UI.ScriptControl.Source { get; set; }PUBLICGETSET

Source code. Replacing the document clears its undo history.

Returns:string—

public int Sandbox.UI.ScriptControl.TabSize { get; set; }PUBLICGETSET

Number of spaces inserted for a tab, clamped to one through eight.

Returns:int—

On this page

Constructorspublic ScriptControl()Methodspublic System.Void AcceptCompletion()public System.Void DismissIntelliSense()public System.Void FocusEditor()public System.Void GoToDiagnostic(System.Boolean previous = False)public System.Void InsertText(System.String text)public virtual System.Void OnDeleted()public System.Void Redo()public System.Void RefreshAnalysis()public System.Void Select(System.Int32 start, System.Int32 length)public System.Void ShowCompletions(System.Boolean explicitRequest = True)public System.Void ShowQuickInfo(System.Int32 offset)public virtual System.Void Tick()public System.Void Undo()Propertiespublic Sandbox.Script.Analysis Sandbox.UI.ScriptControl.Analysis { get; set; }public System.Boolean Sandbox.UI.ScriptControl.CanRedo { get; set; }public System.Boolean Sandbox.UI.ScriptControl.CanUndo { get; set; }public System.Int32 Sandbox.UI.ScriptControl.CaretOffset { get; set; }public System.Int32 Sandbox.UI.ScriptControl.Column { get; set; }public System.Boolean Sandbox.UI.ScriptControl.CompletionVisible { get; set; }public System.Single Sandbox.UI.ScriptControl.DiagnosticDelay { get; set; }public System.Collections.Generic.IReadOnlyList`1<Sandbox.Script.Diagnostic> Sandbox.UI.ScriptControl.Diagnostics { get; set; }public System.Collections.Generic.IReadOnlyList`1<Sandbox.Script.Input> Sandbox.UI.ScriptControl.Inputs { get; set; }public System.Int32 Sandbox.UI.ScriptControl.Line { get; set; }public System.Action`1<System.Collections.Generic.IReadOnlyList`1<Sandbox.Script.Diagnostic>> Sandbox.UI.ScriptControl.OnDiagnosticsChanged { get; set; }public System.Action`1<System.String> Sandbox.UI.ScriptControl.OnSourceChanged { get; set; }public System.Boolean Sandbox.UI.ScriptControl.ReadOnly { get; set; }public System.Boolean Sandbox.UI.ScriptControl.ShowStatusBar { get; set; }public System.String Sandbox.UI.ScriptControl.Source { get; set; }public System.Int32 Sandbox.UI.ScriptControl.TabSize { get; set; }public Sandbox.UI.ScriptControl.ThemeDefinition Sandbox.UI.ScriptControl.Theme { get; set; }Metadata