Class SyntaxHighlighter
- Namespace
- Godot
- Assembly
- GodotSharp.dll
Base class for syntax highlighters. Provides syntax highlighting data to a TextEdit. The associated TextEdit will call into the SyntaxHighlighter on an as-needed basis.
Note: A SyntaxHighlighter instance should not be used across multiple TextEdit nodes.
public class SyntaxHighlighter : Resource, IDisposable
- Inheritance
-
SyntaxHighlighter
- Implements
- Derived
- Inherited Members
Constructors
SyntaxHighlighter()
public SyntaxHighlighter()
Methods
ClearHighlightingCache()
Clears all cached syntax highlighting data.
Then calls overridable method _ClearHighlightingCache().
public void ClearHighlightingCache()
GetLineSyntaxHighlighting(int)
Returns syntax highlighting data for a single line. If the line is not cached, calls _GetLineSyntaxHighlighting(int) to calculate the data.
The return Dictionary is column number to Dictionary. The column number notes the start of a region, the region will end if another region is found, or at the end of the line. The nested Dictionary contains the data for that region, currently only the key "color" is supported.
Example return:
var color_map = {
0: {
"color": Color(1, 0, 0)
},
5: {
"color": Color(0, 1, 0)
}
}
This will color columns 0-4 red, and columns 5-eol in green.
public Dictionary GetLineSyntaxHighlighting(int line)
Parameters
line
int
Returns
GetTextEdit()
Returns the associated TextEdit node.
public TextEdit GetTextEdit()
Returns
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
UpdateCache()
Clears then updates the SyntaxHighlighter caches. Override _UpdateCache() for a callback.
Note: This is called automatically when the associated TextEdit node, updates its own cache.
public void UpdateCache()
_ClearHighlightingCache()
Virtual method which can be overridden to clear any local caches.
public virtual void _ClearHighlightingCache()
_GetLineSyntaxHighlighting(int)
Virtual method which can be overridden to return syntax highlighting data.
See GetLineSyntaxHighlighting(int) for more details.
public virtual Dictionary _GetLineSyntaxHighlighting(int line)
Parameters
line
int
Returns
_UpdateCache()
Virtual method which can be overridden to update any local caches.
public virtual void _UpdateCache()