reckfellENGINE

SyntaxHighlighter

Text-highlighting resource with color-transition maps and its own cache.

On this page
class SyntaxHighlighterReckfellSharpInherits Resource

Create a separate SyntaxHighlighter per TextEdit and assign it through TextEdit.SyntaxHighlighter. The resource stores one editor context: assigning another rebinds it even if the first still references the same resource. Do not share one instance across simultaneous editors.

For custom highlighting, inherit SyntaxHighlighter and override _GetLineSyntaxHighlighting. Return a Dictionary whose key is a Unicode code-point column and whose value is a nested Dictionary containing "color" as a Color. Each color applies until the next key or line end. Transitions at 0 and 5 define two spans rather than one color entry per character.

Use GetLineSyntaxHighlighting to request data through the cache. The returned dictionary is shared with the cache: read it without clearing or modifying it in place. Disposing the C# dictionary wrapper is different from Clear. Line edits automatically invalidate corresponding data.

When custom rules change, clear the resource cache with ClearHighlightingCache or refresh state with UpdateCache, then call EmitChanged: TextEdit also maintains its own cache and listens for the resource’s Changed. ClearHighlightingCache alone does not guarantee an already drawn editor refresh.

GetTextEdit returns a borrowed reference. Do not free the editor through it. Align resource lifetime with the editor and do not request highlighting after the editor is freed; an external resource reference does not keep the UI alive.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

SyntaxHighlighterConstructor
# SyntaxHighlighter
C#
public SyntaxHighlighter();

Creates a resource without an attached editor. The base implementation defines no language rules; override _GetLineSyntaxHighlighting or use CodeHighlighter.

Methods7

ClearHighlightingCachevoid
# ClearHighlightingCache
C#
public void ClearHighlightingCache();

Clears line maps and invokes the clear hook without refreshing every setting. Also call EmitChanged to refresh TextEdit after rule changes: the editor has a separate cache.

GetLineSyntaxHighlightingReckfell.Collections.Dictionary
# GetLineSyntaxHighlighting
C#
public Reckfell.Collections.Dictionary GetLineSyntaxHighlighting(int line);

Returns a cached column → {"color": Color} transition map. Empty without an attached editor. Call this method rather than invoking the virtual hook directly. The dictionary is shared with the cache: do not mutate it in place; dispose the C# wrapper after reading.

Parameters
NameTypeDefault
lineint—
line

Existing logical-line index; result columns count Unicode code points.

Returns Reckfell.Collections.Dictionary

Returns a cached column → {"color": Color} transition map. Empty without an attached editor. Call this method rather than invoking the virtual hook directly. The dictionary is shared with the cache: do not mutate it in place; dispose the C# wrapper after reading.

GetTextEditTextEdit
# GetTextEdit
C#
public TextEdit GetTextEdit();

Borrowed context for one TextEdit, null before attachment. Does not keep the editor alive or permit use after it is freed. A shared resource returns the most recently attached editor.

Returns TextEdit

Borrowed context for one TextEdit, null before attachment. Does not keep the editor alive or permit use after it is freed. A shared resource returns the most recently attached editor.

UpdateCachevoid
# UpdateCache
C#
public void UpdateCache();

Clears maps first, then invokes the update hook with a live attached editor. CodeHighlighter refreshes its base font color. Notify the editor with EmitChanged after external rule/data changes.

_ClearHighlightingCachevoid
# _ClearHighlightingCache
C#
public virtual void _ClearHighlightingCache();

Hook for clearing parser state such as multiline regions. Called by ClearHighlightingCache/UpdateCache. An override replaces the standard hook, so prefer SyntaxHighlighter as the base for a fully custom analyzer.

_GetLineSyntaxHighlightingReckfell.Collections.Dictionary
# _GetLineSyntaxHighlighting
C#
public virtual Reckfell.Collections.Dictionary _GetLineSyntaxHighlighting(int line);

Virtual hook computing one line’s map on a cache miss. Return a Dictionary with integer Unicode code-point columns and nested dictionaries containing a Color under "color". Read text through a live GetTextEdit; do not recursively request GetLineSyntaxHighlighting for the same line.

Parameters
NameTypeDefault
lineint—
line

Existing logical-line index; result columns count Unicode code points.

Returns Reckfell.Collections.Dictionary

Virtual hook computing one line’s map on a cache miss. Return a Dictionary with integer Unicode code-point columns and nested dictionaries containing a Color under "color". Read text through a live GetTextEdit; do not recursively request GetLineSyntaxHighlighting for the same line.

_UpdateCachevoid
# _UpdateCache
C#
public virtual void _UpdateCache();

Hook refreshing custom data after maps are cleared. UpdateCache calls it only with an attached editor. Do not edit document text while computing highlighting.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.