Skip to content

Commit

Permalink
[TextEdit] Add support for using SyntaxHighligther for BiDi override …
Browse files Browse the repository at this point in the history
…and font override.
  • Loading branch information
bruvzg committed Dec 4, 2024
1 parent 47bc374 commit 4ce4dce
Show file tree
Hide file tree
Showing 20 changed files with 1,403 additions and 284 deletions.
209 changes: 183 additions & 26 deletions doc/classes/CodeHighlighter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
A syntax highlighter intended for code.
</brief_description>
<description>
By adjusting various properties of this resource, you can change the colors of strings, comments, numbers, and other text patterns inside a [TextEdit] control.
By adjusting various properties of this resource, you can change the colors and font style of strings, comments, numbers, and other text patterns inside a [TextEdit] control.
</description>
<tutorials>
</tutorials>
<methods>
<method name="add_color_region">
<method name="add_color_region" deprecated="Use [method add_region] instead.">
<return type="void" />
<param index="0" name="start_key" type="String" />
<param index="1" name="end_key" type="String" />
Expand All @@ -20,121 +20,278 @@
If [param line_only] is [code]true[/code] or [param end_key] is an empty [String], the region does not carry over to the next line.
</description>
</method>
<method name="add_keyword_color">
<method name="add_keyword">
<return type="void" />
<param index="0" name="keyword" type="String" />
<param index="1" name="color" type="Color" />
<param index="2" name="style" type="int" enum="SyntaxHighlighter.SyntaxFontStyle" default="0" />
<description>
Sets the color and font style applied to the given keyword.
[param keyword] cannot contain any symbols except [code]_[/code].
</description>
</method>
<method name="add_keyword_color" deprecated="Use [method add_keyword] instead.">
<return type="void" />
<param index="0" name="keyword" type="String" />
<param index="1" name="color" type="Color" />
<description>
Sets the color for a keyword.
The keyword cannot contain any symbols except '_'.
[param keyword] cannot contain any symbols except [code]_[/code].
</description>
</method>
<method name="add_member_keyword_color">
<method name="add_member_keyword">
<return type="void" />
<param index="0" name="member_keyword" type="String" />
<param index="1" name="color" type="Color" />
<param index="2" name="style" type="int" enum="SyntaxHighlighter.SyntaxFontStyle" default="0" />
<description>
Sets the color and font style applied to the given member keyword. Unlike, [method add_keyword], it will not be highlighted if preceded by [code].[/code].
[param member_keyword] cannot contain any symbols except [code]_[/code].
</description>
</method>
<method name="add_member_keyword_color" deprecated="Use [method add_member_keyword] instead.">
<return type="void" />
<param index="0" name="member_keyword" type="String" />
<param index="1" name="color" type="Color" />
<description>
Sets the color applied to the given member keyword. Unlike, [method add_keyword], it will not be highlighted if preceded by [code].[/code].
[param member_keyword] cannot contain any symbols except [code]_[/code].
</description>
</method>
<method name="add_region">
<return type="void" />
<param index="0" name="start_key" type="String" />
<param index="1" name="end_key" type="String" />
<param index="2" name="color" type="Color" />
<param index="3" name="style" type="int" enum="SyntaxHighlighter.SyntaxFontStyle" default="0" />
<param index="4" name="line_only" type="bool" default="false" />
<param index="5" name="text_segment" type="bool" default="false" />
<description>
Sets the color for a member keyword.
The member keyword cannot contain any symbols except '_'.
It will not be highlighted if preceded by a '.'.
Adds a color and font style region (such as for comments or strings) from [param start_key] to [param end_key]. Both keys should be symbols, and [param start_key] must not be shared with other delimiters.
If [param line_only] is [code]true[/code] or [param end_key] is an empty [String], the region does not carry over to the next line.
</description>
</method>
<method name="clear_color_regions">
<method name="clear_color_regions" deprecated="Use [method clear_regions] instead.">
<return type="void" />
<description>
Removes all color regions.
</description>
</method>
<method name="clear_keyword_colors">
<method name="clear_keyword_colors" deprecated="Use [method clear_keywords] instead.">
<return type="void" />
<description>
Removes all keywords.
</description>
</method>
<method name="clear_member_keyword_colors">
<method name="clear_keywords">
<return type="void" />
<description>
Removes all keywords.
</description>
</method>
<method name="clear_member_keyword_colors" deprecated="Use [method clear_member_keywords] instead.">
<return type="void" />
<description>
Removes all member keywords.
</description>
</method>
<method name="clear_member_keywords">
<return type="void" />
<description>
Removes all member keywords.
</description>
</method>
<method name="clear_regions">
<return type="void" />
<description>
Removes all color and font style regions.
</description>
</method>
<method name="get_color_regions" qualifiers="const" deprecated="Use [member regions] instead.">
<return type="Dictionary" />
<description>
Returns all color regions, as a dictionary.
</description>
</method>
<method name="get_keyword_color" qualifiers="const">
<return type="Color" />
<param index="0" name="keyword" type="String" />
<description>
Returns the color for a keyword.
</description>
</method>
<method name="get_keyword_colors" qualifiers="const" deprecated="Use [member keywords] instead.">
<return type="Dictionary" />
<description>
Returns the colors applied to all keywords, as a dictionary.
</description>
</method>
<method name="get_keyword_style" qualifiers="const">
<return type="int" enum="SyntaxHighlighter.SyntaxFontStyle" />
<param index="0" name="keyword" type="String" />
<description>
Returns the font style used for a keyword.
</description>
</method>
<method name="get_member_keyword_color" qualifiers="const">
<return type="Color" />
<param index="0" name="member_keyword" type="String" />
<description>
Returns the color for a member keyword.
</description>
</method>
<method name="has_color_region" qualifiers="const">
<method name="get_member_keyword_colors" qualifiers="const" deprecated="Use [member member_keywords] instead.">
<return type="Dictionary" />
<description>
Returns the colors applied to all member keywords, as a dictionary.
</description>
</method>
<method name="get_member_keyword_style" qualifiers="const">
<return type="int" enum="SyntaxHighlighter.SyntaxFontStyle" />
<param index="0" name="member_keyword" type="String" />
<description>
Returns the font style used for the given member keyword.
</description>
</method>
<method name="has_color_region" qualifiers="const" deprecated="Use [method has_region] instead.">
<return type="bool" />
<param index="0" name="start_key" type="String" />
<description>
Returns [code]true[/code] if the start key exists, else [code]false[/code].
</description>
</method>
<method name="has_keyword_color" qualifiers="const">
<method name="has_keyword" qualifiers="const">
<return type="bool" />
<param index="0" name="keyword" type="String" />
<description>
Returns [code]true[/code] if the keyword exists, else [code]false[/code].
</description>
</method>
<method name="has_keyword_color" qualifiers="const" deprecated="Use [method has_keyword] instead.">
<return type="bool" />
<param index="0" name="keyword" type="String" />
<description>
Returns [code]true[/code] if the keyword exists, else [code]false[/code].
</description>
</method>
<method name="has_member_keyword_color" qualifiers="const">
<method name="has_member_keyword" qualifiers="const">
<return type="bool" />
<param index="0" name="member_keyword" type="String" />
<description>
Returns [code]true[/code] if the member keyword exists, else [code]false[/code].
</description>
</method>
<method name="remove_color_region">
<method name="has_member_keyword_color" qualifiers="const" deprecated="Use [method has_member_keyword] instead.">
<return type="bool" />
<param index="0" name="member_keyword" type="String" />
<description>
Returns [code]true[/code] if the member keyword exists, else [code]false[/code].
</description>
</method>
<method name="has_region" qualifiers="const">
<return type="bool" />
<param index="0" name="start_key" type="String" />
<description>
Returns [code]true[/code] if the start key exists, else [code]false[/code].
</description>
</method>
<method name="remove_color_region" deprecated="Use [method remove_region] instead.">
<return type="void" />
<param index="0" name="start_key" type="String" />
<description>
Removes the color region that uses that start key.
</description>
</method>
<method name="remove_keyword_color">
<method name="remove_keyword">
<return type="void" />
<param index="0" name="keyword" type="String" />
<description>
Removes the keyword.
</description>
</method>
<method name="remove_member_keyword_color">
<method name="remove_keyword_color" deprecated="Use [method remove_keyword] instead.">
<return type="void" />
<param index="0" name="keyword" type="String" />
<description>
Removes the keyword.
</description>
</method>
<method name="remove_member_keyword">
<return type="void" />
<param index="0" name="member_keyword" type="String" />
<description>
Removes the member keyword.
</description>
</method>
<method name="remove_member_keyword_color" deprecated="Use [method remove_member_keyword] instead.">
<return type="void" />
<param index="0" name="member_keyword" type="String" />
<description>
Removes the member keyword.
</description>
</method>
<method name="remove_region">
<return type="void" />
<param index="0" name="start_key" type="String" />
<description>
Removes the color or font style region that uses the given start key.
</description>
</method>
<method name="set_color_regions" deprecated="Use [member regions] instead.">
<return type="void" />
<param index="0" name="color_regions" type="Dictionary" />
<description>
Sets color regions.
</description>
</method>
<method name="set_keyword_colors" deprecated="Use [member keywords] instead.">
<return type="void" />
<param index="0" name="keywords" type="Dictionary" />
<description>
Sets colors for keywords.
</description>
</method>
<method name="set_member_keyword_colors" deprecated="Use [member member_keywords] instead.">
<return type="void" />
<param index="0" name="member_keyword" type="Dictionary" />
<description>
Sets colors for member keywords.
</description>
</method>
</methods>
<members>
<member name="color_regions" type="Dictionary" setter="set_color_regions" getter="get_color_regions" default="{}">
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.
</member>
<member name="function_color" type="Color" setter="set_function_color" getter="get_function_color" default="Color(0, 0, 0, 1)">
Sets color for functions. A function is a non-keyword string followed by a '('.
Sets color for functions. A function is a non-keyword string followed by a [code]([/code].
</member>
<member name="function_style" type="int" setter="set_function_style" getter="get_function_style" enum="SyntaxHighlighter.SyntaxFontStyle" default="0">
Sets the font style for functions. A function is a non-keyword string followed by [code]([/code].
</member>
<member name="keyword_colors" type="Dictionary" setter="set_keyword_colors" getter="get_keyword_colors" default="{}">
Sets the keyword colors. All existing keywords will be removed. The [Dictionary] key is the keyword. The value is the keyword color.
<member name="keywords" type="Dictionary" setter="set_keywords" getter="get_keywords" default="{}">
Color and font style for keywords, as a [Dictionary] where each key is a keyword [String] and each value is a nested [Dictionary] with the following keys: [code]"color"[/code], [code]"style"[/code].
</member>
<member name="member_keyword_colors" type="Dictionary" setter="set_member_keyword_colors" getter="get_member_keyword_colors" default="{}">
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.
<member name="member_keywords" type="Dictionary" setter="set_member_keywords" getter="get_member_keywords" default="{}">
Color and font style for member keywords, as a [Dictionary] where each key is a keyword [String] and each value is a nested [Dictionary] with the following keys: [code]"color"[/code], [code]"style"[/code].
</member>
<member name="member_variable_color" type="Color" setter="set_member_variable_color" getter="get_member_variable_color" default="Color(0, 0, 0, 1)">
Sets color for member variables. A member variable is non-keyword, non-function string proceeded with a '.'.
Sets color for member variables. A member variable is non-keyword, non-function string proceeded with a [code].[/code].
</member>
<member name="member_variable_style" type="int" setter="set_member_variable_style" getter="get_member_variable_style" enum="SyntaxHighlighter.SyntaxFontStyle" default="0">
Sets the font style for member variables. A member variable is non-keyword, non-function string proceeded with a [code].[/code].
</member>
<member name="number_color" type="Color" setter="set_number_color" getter="get_number_color" default="Color(0, 0, 0, 1)">
Sets the color for numbers.
</member>
<member name="number_style" type="int" setter="set_number_style" getter="get_number_style" enum="SyntaxHighlighter.SyntaxFontStyle" default="0">
Sets the font style for numbers.
</member>
<member name="regions" type="Dictionary" setter="set_regions" getter="get_regions" default="{}">
Color and font style regions, [Dictionary] keys are [code]"start_key end_key"[/code] string, values are [Dictionary] with the following keys: [code]"color"[/code], [code]"style"[/code], and [code]text_segment[/code].
</member>
<member name="symbol_color" type="Color" setter="set_symbol_color" getter="get_symbol_color" default="Color(0, 0, 0, 1)">
Sets the color for symbols.
</member>
<member name="symbol_style" type="int" setter="set_symbol_style" getter="get_symbol_style" enum="SyntaxHighlighter.SyntaxFontStyle" default="0">
Sets the font style for symbols.
</member>
</members>
</class>
Loading

0 comments on commit 4ce4dce

Please sign in to comment.