Class CodeEdit

Namespace
Forma
Assembly
Forma.dll

Godot-inspired code editor with indentation, brace completion and debugger-oriented gutters.

public sealed class CodeEdit : TextEdit, IAddChild<Control>, IAddChild, INotifyPropertyChanged, IDisposable
Inheritance
CodeEdit
Implements
Inherited Members

Constructors

CodeEdit()

public CodeEdit()

Properties

AutoBraceCompletionEnabled

public bool AutoBraceCompletionEnabled { get; set; }

Property Value

bool

AutoIndentEnabled

public bool AutoIndentEnabled { get; set; }

Property Value

bool

AutoIndentPrefixes

public IReadOnlyList<string> AutoIndentPrefixes { get; }

Property Value

IReadOnlyList<string>

BookmarkColor

public Color BookmarkColor { get; set; }

Property Value

Color

BreakpointColor

public Color BreakpointColor { get; set; }

Property Value

Color

CodeCompletionEnabled

Enables Godot-style retained code-completion requests, candidate selection, and confirmation.

public bool CodeCompletionEnabled { get; set; }

Property Value

bool

CodeCompletionMaxLines

public int CodeCompletionMaxLines { get; set; }

Property Value

int

CodeCompletionOptions

public IReadOnlyList<CodeCompletionOption> CodeCompletionOptions { get; }

Property Value

IReadOnlyList<CodeCompletionOption>

CodeCompletionPrefixes

public IReadOnlyList<string> CodeCompletionPrefixes { get; }

Property Value

IReadOnlyList<string>

CodeHint

Godot-style function/signature help text anchored at the active caret.

public string CodeHint { get; }

Property Value

string

CodeHintDrawBelow

Places the code hint below rather than above the caret when space permits.

public bool CodeHintDrawBelow { get; }

Property Value

bool

DrawBookmarksGutter

public bool DrawBookmarksGutter { get; set; }

Property Value

bool

DrawBreakpointsGutter

public bool DrawBreakpointsGutter { get; set; }

Property Value

bool

DrawExecutingLinesGutter

public bool DrawExecutingLinesGutter { get; set; }

Property Value

bool

DrawFoldGutter

Shows Godot's fold affordance beside the code line-number gutter.

public bool DrawFoldGutter { get; set; }

Property Value

bool

DrawLineNumbers

public bool DrawLineNumbers { get; set; }

Property Value

bool

DrawMinimap

public bool DrawMinimap { get; set; }

Property Value

bool

ExecutingLineColor

public Color ExecutingLineColor { get; set; }

Property Value

Color

IndentSize

public int IndentSize { get; set; }

Property Value

int

IndentText

public string IndentText { get; }

Property Value

string

IndentUsingSpaces

public bool IndentUsingSpaces { get; set; }

Property Value

bool

IsCodeCompletionActive

public bool IsCodeCompletionActive { get; }

Property Value

bool

LineCommentDelimiters

Configured one-line comment markers that can prefix Godot-style code-region tags.

public IReadOnlyList<string> LineCommentDelimiters { get; }

Property Value

IReadOnlyList<string>

LineFoldingEnabled

Enables indentation-based source-line folding without changing the underlying document text.

public bool LineFoldingEnabled { get; set; }

Property Value

bool

LineLengthGuidelineColor

public Color LineLengthGuidelineColor { get; set; }

Property Value

Color

LineLengthGuidelines

public IReadOnlyList<int> LineLengthGuidelines { get; }

Property Value

IReadOnlyList<int>

LineNumbersMinDigits

public int LineNumbersMinDigits { get; set; }

Property Value

int

LineNumbersZeroPadded

public bool LineNumbersZeroPadded { get; set; }

Property Value

bool

SymbolLookupOnClickEnabled

public bool SymbolLookupOnClickEnabled { get; }

Property Value

bool

SymbolLookupWord

Last host-validated Command/Ctrl-click symbol, or empty while no lookup is active.

public string SymbolLookupWord { get; }

Property Value

string

TextContentLeftInset

Extra horizontal space reserved by specialized text editors before their editable content.

protected override float TextContentLeftInset { get; }

Property Value

float

Methods

AddAutoBraceCompletionPair(string, string)

public void AddAutoBraceCompletionPair(string openKey, string closeKey)

Parameters

openKey string
closeKey string

AddCodeCompletionOption(CodeCompletionKind, string, string, Color?, object, int, Texture2D)

public void AddCodeCompletionOption(CodeCompletionKind type, string displayText, string insertText, Color? textColor = null, object value = null, int location = 0, Texture2D icon = null)

Parameters

type CodeCompletionKind
displayText string
insertText string
textColor Color?
value object
location int
icon Texture2D

AddCommentDelimiter(string, string, bool)

Adds a comment delimiter. Line-only delimiters enable code-region tags; paired delimiters enable multiline comment folding.

public void AddCommentDelimiter(string startKey, string endKey = "", bool lineOnly = false)

Parameters

startKey string
endKey string
lineOnly bool

AddStringDelimiter(string, string, bool)

public void AddStringDelimiter(string startKey, string endKey, bool lineOnly = false)

Parameters

startKey string
endKey string
lineOnly bool

CanFoldLine(int)

Returns whether this non-empty line introduces an indented child block that can be folded.

public bool CanFoldLine(int line)

Parameters

line int

Returns

bool

CancelCodeCompletion()

public void CancelCodeCompletion()

ClearBookmarkedLines()

public void ClearBookmarkedLines()

ClearBreakpointedLines()

public void ClearBreakpointedLines()

ClearCommentDelimiters()

public void ClearCommentDelimiters()

ClearExecutingLines()

public void ClearExecutingLines()

ClearStringDelimiters()

public void ClearStringDelimiters()

ConfirmCodeCompletion(bool)

public void ConfirmCodeCompletion(bool replace = false)

Parameters

replace bool

CreateCodeRegion()

Wraps the selected line range in configured code-region tags and folds the new region.

public void CreateCodeRegion()

DeleteLines()

Deletes the selected lines, or the caret line, retaining a single empty line for an otherwise empty document.

public void DeleteLines()

DuplicateLines()

Duplicates the selected lines, or the caret line, immediately below the original range.

public void DuplicateLines()

DuplicateSelection()

Duplicates the selected text, or delegates to DuplicateLines() when no range is selected.

public void DuplicateSelection()

FoldAllLines()

public void FoldAllLines()

FoldLine(int)

Hides the contiguous indented block below line, matching Godot's source folding model.

public void FoldLine(int line)

Parameters

line int

GetAutoBraceCompletionCloseKey(string)

public string GetAutoBraceCompletionCloseKey(string openKey)

Parameters

openKey string

Returns

string

GetBookmarkedLines()

public IReadOnlyList<int> GetBookmarkedLines()

Returns

IReadOnlyList<int>

GetBreakpointedLines()

public IReadOnlyList<int> GetBreakpointedLines()

Returns

IReadOnlyList<int>

GetCodeCompletionOption(int)

public CodeCompletionOption GetCodeCompletionOption(int index)

Parameters

index int

Returns

CodeCompletionOption

GetCodeCompletionSelectedIndex()

public int GetCodeCompletionSelectedIndex()

Returns

int

GetCodeHintBounds()

Returns the current caret-relative retained code-hint panel bounds, or an empty rectangle without a hint.

public Rectangle GetCodeHintBounds()

Returns

Rectangle

GetCodeRegionEndTag()

public string GetCodeRegionEndTag()

Returns

string

GetCodeRegionStartTag()

public string GetCodeRegionStartTag()

Returns

string

GetExecutingLines()

public IReadOnlyList<int> GetExecutingLines()

Returns

IReadOnlyList<int>

GetFoldedLineHeader(int)

public int GetFoldedLineHeader(int line)

Parameters

line int

Returns

int

GetFoldedLines()

public IReadOnlyList<int> GetFoldedLines()

Returns

IReadOnlyList<int>

GetLineLengthGuidelineX(int)

Returns the screen-space x coordinate for a configured guideline column.

public int GetLineLengthGuidelineX(int column)

Parameters

column int

Returns

int

GetLineLengthGuidelines()

public IReadOnlyList<int> GetLineLengthGuidelines()

Returns

IReadOnlyList<int>

GetLookupWord(int, int)

public string GetLookupWord(int line, int column)

Parameters

line int
column int

Returns

string

GetMinimapBounds()

Returns the retained minimap lane, or an empty rectangle while minimap drawing is disabled.

public Rectangle GetMinimapBounds()

Returns

Rectangle

GetMinimapViewportBounds()

Returns the minimap rectangle representing the current wrap-aware code viewport.

public Rectangle GetMinimapViewportBounds()

Returns

Rectangle

GetTextForCodeCompletion()

Returns the complete text with U+FFFF at the active caret, matching Godot's completion-provider contract.

public string GetTextForCodeCompletion()

Returns

string

GetTextForSymbolLookup()

Returns complete source text with U+FFFF at the last pointer position used for symbol lookup, or the caret when there is none.

public string GetTextForSymbolLookup()

Returns

string

GetTextWithCursorChar(int, int)

public string GetTextWithCursorChar(int line, int column)

Parameters

line int
column int

Returns

string

HasAutoBraceCompletionCloseKey(string)

public bool HasAutoBraceCompletionCloseKey(string closeKey)

Parameters

closeKey string

Returns

bool

HasAutoBraceCompletionOpenKey(string)

public bool HasAutoBraceCompletionOpenKey(string openKey)

Parameters

openKey string

Returns

bool

HasCommentDelimiter(string)

public bool HasCommentDelimiter(string startKey)

Parameters

startKey string

Returns

bool

HasStringDelimiter(string)

public bool HasStringDelimiter(string startKey)

Parameters

startKey string

Returns

bool

IndentLines()

Indents the current selection, or the caret line when no selection exists.

public void IndentLines()

InsertCodeText(string)

public void InsertCodeText(string text)

Parameters

text string

InsertText(string)

Routes normal window text input through CodeEdit's brace and indentation behavior.

public override void InsertText(string text)

Parameters

text string

IsCodeCompletionEnabled()

public bool IsCodeCompletionEnabled()

Returns

bool

IsDrawingFoldGutter()

public bool IsDrawingFoldGutter()

Returns

bool

IsLineBookmarked(int)

public bool IsLineBookmarked(int line)

Parameters

line int

Returns

bool

IsLineBreakpointed(int)

public bool IsLineBreakpointed(int line)

Parameters

line int

Returns

bool

IsLineCodeRegionEnd(int)

public bool IsLineCodeRegionEnd(int line)

Parameters

line int

Returns

bool

IsLineCodeRegionStart(int)

public bool IsLineCodeRegionStart(int line)

Parameters

line int

Returns

bool

IsLineExecuting(int)

public bool IsLineExecuting(int line)

Parameters

line int

Returns

bool

IsLineFolded(int)

public bool IsLineFolded(int line)

Parameters

line int

Returns

bool

IsLineFoldingEnabled()

public bool IsLineFoldingEnabled()

Returns

bool

IsLineHiddenForDisplay(int)

Allows specialized editors to hide document lines without mutating the underlying text.

protected override bool IsLineHiddenForDisplay(int line)

Parameters

line int

Returns

bool

IsSymbolLookupOnClickEnabled()

public bool IsSymbolLookupOnClickEnabled()

Returns

bool

JoinLines(string)

Joins the selected line range, or the caret line and its next line, using lineEnding.

public void JoinLines(string lineEnding = " ")

Parameters

lineEnding string

MoveLinesDown()

Moves the selected lines, or the caret line, one logical row downward without changing their contents.

public void MoveLinesDown()

MoveLinesUp()

Moves the selected lines, or the caret line, one logical row upward without changing their contents.

public void MoveLinesUp()

RemoveCommentDelimiter(string)

public void RemoveCommentDelimiter(string startKey)

Parameters

startKey string

RemoveStringDelimiter(string)

public void RemoveStringDelimiter(string startKey)

Parameters

startKey string

RequestCodeCompletion(bool)

public void RequestCodeCompletion(bool force = false)

Parameters

force bool

SetAutoIndentPrefixes(IEnumerable<string>)

public void SetAutoIndentPrefixes(IEnumerable<string> prefixes)

Parameters

prefixes IEnumerable<string>

SetCodeCompletionEnabled(bool)

public void SetCodeCompletionEnabled(bool enabled)

Parameters

enabled bool

SetCodeCompletionPrefixes(IEnumerable<string>)

public void SetCodeCompletionPrefixes(IEnumerable<string> prefixes)

Parameters

prefixes IEnumerable<string>

SetCodeCompletionSelectedIndex(int)

public void SetCodeCompletionSelectedIndex(int index)

Parameters

index int

SetCodeHint(string)

public void SetCodeHint(string hint)

Parameters

hint string

SetCodeHintDrawBelow(bool)

public void SetCodeHintDrawBelow(bool below)

Parameters

below bool

SetCodeRegionTags(string, string)

public void SetCodeRegionTags(string start = "region", string end = "endregion")

Parameters

start string
end string

SetDrawFoldGutter(bool)

public void SetDrawFoldGutter(bool draw)

Parameters

draw bool

SetLineAsBookmarked(int, bool)

public void SetLineAsBookmarked(int line, bool bookmarked)

Parameters

line int
bookmarked bool

SetLineAsBreakpoint(int, bool)

public void SetLineAsBreakpoint(int line, bool breakpointed)

Parameters

line int
breakpointed bool

SetLineAsExecuting(int, bool)

public void SetLineAsExecuting(int line, bool executing)

Parameters

line int
executing bool

SetLineFoldingEnabled(bool)

public void SetLineFoldingEnabled(bool enabled)

Parameters

enabled bool

SetLineLengthGuidelines(IEnumerable<int>)

public void SetLineLengthGuidelines(IEnumerable<int> guidelineColumns)

Parameters

guidelineColumns IEnumerable<int>

SetSymbolLookupOnClickEnabled(bool)

public void SetSymbolLookupOnClickEnabled(bool enabled)

Parameters

enabled bool

SetSymbolLookupWordAsValid(bool)

Accepts or rejects the pending Command/Ctrl-click lookup word after the host resolves it.

public void SetSymbolLookupWordAsValid(bool valid)

Parameters

valid bool

ToggleFoldableLine(int)

public void ToggleFoldableLine(int line)

Parameters

line int

ToggleFoldableLinesAtCarets()

public void ToggleFoldableLinesAtCarets()

UnfoldAllLines()

public void UnfoldAllLines()

UnfoldLine(int)

Reveals a folded header, or the header that contains the requested hidden line.

public void UnfoldLine(int line)

Parameters

line int

UnindentLines()

Removes one configured indentation level from the current selection or caret line.

public void UnindentLines()

UpdateCodeCompletionOptions(bool)

public void UpdateCodeCompletionOptions(bool forced = false)

Parameters

forced bool

Events

CodeCompletionRequested

Raised synchronously when the host should submit candidates through AddCodeCompletionOption(CodeCompletionKind, string, string, Color?, object, int, Texture2D).

public event Action<CodeEdit, bool> CodeCompletionRequested

Event Type

Action<CodeEdit, bool>

FoldStateChanged

Raised after an indentation-based fold or unfold changes visible code lines.

public event Action<CodeEdit> FoldStateChanged

Event Type

Action<CodeEdit>

LineChanged

public event Action<CodeEdit, int> LineChanged

Event Type

Action<CodeEdit, int>

SymbolLookupRequested

Raised for a Command/Ctrl-click word when SymbolLookupOnClickEnabled is enabled.

public event Action<CodeEdit, string, int, int> SymbolLookupRequested

Event Type

Action<CodeEdit, string, int, int>