Class CodeHighlighter
- Namespace
- Godot
- Assembly
- GodotSharp.dll
By adjusting various properties of this resource, you can change the colors of strings, comments, numbers, and other text patterns inside a TextEdit control.
public class CodeHighlighter : SyntaxHighlighter, IDisposable
- Inheritance
-
CodeHighlighter
- Implements
- Inherited Members
Constructors
CodeHighlighter()
public CodeHighlighter()
Properties
ColorRegions
Sets the color regions. All existing regions will be removed. The Dictionary key is the region start and end key, separated by a space. The value is the region color.
public Dictionary ColorRegions { get; set; }
Property Value
FunctionColor
Sets color for functions. A function is a non-keyword string followed by a '('.
public Color FunctionColor { get; set; }
Property Value
KeywordColors
Sets the keyword colors. All existing keywords will be removed. The Dictionary key is the keyword. The value is the keyword color.
public Dictionary KeywordColors { get; set; }
Property Value
MemberKeywordColors
Sets the member keyword colors. All existing member keyword will be removed. The Dictionary key is the member keyword. The value is the member keyword color.
public Dictionary MemberKeywordColors { get; set; }
Property Value
MemberVariableColor
Sets color for member variables. A member variable is non-keyword, non-function string proceeded with a '.'.
public Color MemberVariableColor { get; set; }
Property Value
NumberColor
Sets the color for numbers.
public Color NumberColor { get; set; }
Property Value
SymbolColor
Sets the color for symbols.
public Color SymbolColor { get; set; }
Property Value
Methods
AddColorRegion(string, string, Color, bool)
Adds a color region such as comments or strings.
Both the start and end keys must be symbols. Only the start key has to be unique.
lineOnly
denotes if the region should continue until the end of the line or carry over on to the next line. If the end key is blank this is automatically set to true
.
public void AddColorRegion(string startKey, string endKey, Color color, bool lineOnly = false)
Parameters
AddKeywordColor(string, Color)
Sets the color for a keyword.
The keyword cannot contain any symbols except '_'.
public void AddKeywordColor(string keyword, Color color)
Parameters
AddMemberKeywordColor(string, Color)
Sets the color for a member keyword.
The member keyword cannot contain any symbols except '_'.
It will not be highlighted if preceded by a '.'.
public void AddMemberKeywordColor(string memberKeyword, Color color)
Parameters
ClearColorRegions()
Removes all color regions.
public void ClearColorRegions()
ClearKeywordColors()
Removes all keywords.
public void ClearKeywordColors()
ClearMemberKeywordColors()
Removes all member keywords.
public void ClearMemberKeywordColors()
GetKeywordColor(string)
Returns the color for a keyword.
public Color GetKeywordColor(string keyword)
Parameters
keyword
string
Returns
GetMemberKeywordColor(string)
Returns the color for a member keyword.
public Color GetMemberKeywordColor(string memberKeyword)
Parameters
memberKeyword
string
Returns
HasColorRegion(string)
Returns true
if the start key exists, else false
.
public bool HasColorRegion(string startKey)
Parameters
startKey
string
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
HasKeywordColor(string)
Returns true
if the keyword exists, else false
.
public bool HasKeywordColor(string keyword)
Parameters
keyword
string
Returns
HasMemberKeywordColor(string)
Returns true
if the member keyword exists, else false
.
public bool HasMemberKeywordColor(string memberKeyword)
Parameters
memberKeyword
string
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
RemoveColorRegion(string)
Removes the color region that uses that start key.
public void RemoveColorRegion(string startKey)
Parameters
startKey
string
RemoveKeywordColor(string)
Removes the keyword.
public void RemoveKeywordColor(string keyword)
Parameters
keyword
string
RemoveMemberKeywordColor(string)
Removes the member keyword.
public void RemoveMemberKeywordColor(string memberKeyword)
Parameters
memberKeyword
string