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 Sep 9, 2024
1 parent d0dc389 commit 03cd2bd
Show file tree
Hide file tree
Showing 20 changed files with 1,375 additions and 268 deletions.
199 changes: 179 additions & 20 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,7 +20,17 @@
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 the font style for a keyword.
The keyword cannot contain any symbols except '_'.
</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" />
Expand All @@ -29,7 +39,18 @@
The keyword cannot contain any symbols except '_'.
</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 the font style for a member keyword.
The member keyword cannot contain any symbols except '_'.
It will not be highlighted if preceded by a '.'.
</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" />
Expand All @@ -39,102 +60,240 @@
It will not be highlighted if preceded by a '.'.
</description>
</method>
<method name="clear_color_regions">
<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>
Adds a color / 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" 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_keywords">
<return type="void" />
<description>
Removes all keywords.
</description>
</method>
<method name="clear_member_keyword_colors">
<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 / font style regions.
</description>
</method>
<method name="get_color_regions" qualifiers="const" deprecated="Use [member regions] instead.">
<return type="Dictionary" />
<description>
Returns color regions.
</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 colors for keywords.
</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 is 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 colors for member keywords.
</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 is used for a 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_member_keyword_color" qualifiers="const">
<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" 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="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="remove_color_region">
<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 / font style region that uses that 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 '('.
</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="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 a '('.
</member>
<member name="keywords" type="Dictionary" setter="set_keywords" getter="get_keywords" default="{}">
Color / font style for keywords, [Dictionary] keys are [code]"keyword"[/code] string, values are [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 / font style for member keywords, [Dictionary] keys are [code]"member_keyword"[/code] string, values are [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 '.'.
</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 '.'.
</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 / 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 03cd2bd

Please sign in to comment.