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.
Constructors1
Showing 1 constructors
public ScriptControl()
No results match this filter.
Methods13
Showing 13 methods
public void AcceptCompletion()
Replace the current completion range with the selected suggestion as an undoable edit.
void—public void DismissIntelliSense()
Close completion, parameter help and hover documentation.
void—public void FocusEditor()
Give keyboard focus to the text editor.
void—public void GoToDiagnostic(bool previous = False)
Move to the next diagnostic (F8), or the previous one (Shift+F8).
| Parameter | Type | Description |
|---|---|---|
| previous = False | bool | — |
void—public void InsertText(string text)
Insert text at the selection as one undoable edit.
| Parameter | Type | Description |
|---|---|---|
| text | string | — |
void—public virtual void OnDeleted()
void—public void Redo()
Reapply the last undone edit and close IntelliSense.
void—public void RefreshAnalysis()
Immediately recreate analysis after input metadata or scripting permissions change.
void—public void Select(int start, int length)
Select a range of source code, measured in UTF-16 units.
| Parameter | Type | Description |
|---|---|---|
| start | int | — |
| length | int | — |
void—public void ShowCompletions(bool explicitRequest = True)
Open permitted completions for the current caret. Ctrl+Space invokes this.
| Parameter | Type | Description |
|---|---|---|
| explicitRequest = True | bool | — |
void—public void ShowQuickInfo(int offset)
Display symbol documentation or a diagnostic at a UTF-16 source offset.
| Parameter | Type | Description |
|---|---|---|
| offset | int | — |
void—public virtual void Tick()
void—public void Undo()
Undo the last edit and close IntelliSense.
void—No results match this filter.
Properties17
Showing 17 properties
public Sandbox.Script.Analysis Sandbox.UI.ScriptControl.Analysis { get; set; }
The current immutable metadata snapshot, updated immediately when the source or inputs change.
public bool Sandbox.UI.ScriptControl.CanRedo { get; set; }
Whether an undone edit is available to redo.
bool—public bool Sandbox.UI.ScriptControl.CanUndo { get; set; }
Whether an edit is available to undo.
bool—public int Sandbox.UI.ScriptControl.CaretOffset { get; set; }
Caret position measured in UTF-16 source units.
int—public int Sandbox.UI.ScriptControl.Column { get; set; }
One-based text-element column at the caret.
int—public bool Sandbox.UI.ScriptControl.CompletionVisible { get; set; }
Whether the completion list is open.
bool—public float Sandbox.UI.ScriptControl.DiagnosticDelay { get; set; }
Seconds of idle time before showing diagnostics. Highlighting stays immediate.
float—public System.Collections.Generic.IReadOnlyList`1<Sandbox.Script.Diagnostic> Sandbox.UI.ScriptControl.Diagnostics { get; set; }
Diagnostics from the current analysis, including those waiting for the display delay.
public System.Collections.Generic.IReadOnlyList`1<Sandbox.Script.Input> Sandbox.UI.ScriptControl.Inputs { get; set; }
Typed external inputs made available to script analysis.
public int Sandbox.UI.ScriptControl.Line { get; set; }
One-based line number at the caret.
int—public System.Action`1<System.Collections.Generic.IReadOnlyList`1<Sandbox.Script.Diagnostic>> Sandbox.UI.ScriptControl.OnDiagnosticsChanged { get; set; }
Called when analysis produces a new diagnostic snapshot, before the display delay.
public System.Action`1<string> Sandbox.UI.ScriptControl.OnSourceChanged { get; set; }
Called immediately when the source text changes, including IME previews.
Action<string>—public bool Sandbox.UI.ScriptControl.ReadOnly { get; set; }
Allow selection and navigation while preventing edits.
bool—public bool Sandbox.UI.ScriptControl.ShowStatusBar { get; set; }
Show the optional status bar beneath the editor.
bool—public string Sandbox.UI.ScriptControl.Source { get; set; }
Source code. Replacing the document clears its undo history.
string—public int Sandbox.UI.ScriptControl.TabSize { get; set; }
Number of spaces inserted for a tab, clamped to one through eight.
int—public Sandbox.UI.ScriptControl.ThemeDefinition Sandbox.UI.ScriptControl.Theme { get; set; }
Colors used by this editor. Assigning a new theme updates existing text and popups without changing the document, selection or undo history.
No results match this filter.