| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="SyntaxHighlighter" inherits="Resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | Base class for syntax highlighters. Provides syntax highlighting data to a [TextEdit]. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | 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. |
| 8 | [b]Note:[/b] A [SyntaxHighlighter] instance should not be used across multiple [TextEdit] nodes. |
| 9 | </description> |
| 10 | <tutorials> |
| 11 | </tutorials> |
| 12 | <methods> |
| 13 | <method name="_clear_highlighting_cache" qualifiers="virtual"> |
| 14 | <return type="void" /> |
| 15 | <description> |
| 16 | Virtual method which can be overridden to clear any local caches. |
| 17 | </description> |
| 18 | </method> |
| 19 | <method name="_get_line_syntax_highlighting" qualifiers="virtual const"> |
| 20 | <return type="Dictionary" /> |
| 21 | <param index="0" name="line" type="int" /> |
| 22 | <description> |
| 23 | Virtual method which can be overridden to return syntax highlighting data. |
| 24 | See [method get_line_syntax_highlighting] for more details. |
| 25 | </description> |
| 26 | </method> |
| 27 | <method name="_update_cache" qualifiers="virtual"> |
| 28 | <return type="void" /> |
| 29 | <description> |
| 30 | Virtual method which can be overridden to update any local caches. |
| 31 | </description> |
| 32 | </method> |
| 33 | <method name="clear_highlighting_cache"> |
| 34 | <return type="void" /> |
| 35 | <description> |
| 36 | Clears all cached syntax highlighting data. |
| 37 | Then calls overridable method [method _clear_highlighting_cache]. |
| 38 | </description> |
| 39 | </method> |
| 40 | <method name="get_line_syntax_highlighting"> |
| 41 | <return type="Dictionary" /> |
| 42 | <param index="0" name="line" type="int" /> |
| 43 | <description> |
| 44 | Returns the syntax highlighting data for the line at index [param line]. If the line is not cached, calls [method _get_line_syntax_highlighting] first to calculate the data. |
| 45 | Each entry is a column number containing a nested [Dictionary]. The column number denotes 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 [code]"color"[/code] is supported. |
| 46 | [b]Example:[/b] Possible return value. This means columns [code]0[/code] to [code]4[/code] should be red, and columns [code]5[/code] to the end of the line should be green: |
| 47 | [codeblock] |
| 48 | { |
| 49 | 0: { |
| 50 | "color": Color(1, 0, 0) |
| 51 | }, |
| 52 | 5: { |
| 53 | "color": Color(0, 1, 0) |
| 54 | } |
| 55 | } |
| 56 | [/codeblock] |
| 57 | </description> |
| 58 | </method> |
| 59 | <method name="get_text_edit" qualifiers="const"> |
| 60 | <return type="TextEdit" /> |
| 61 | <description> |
| 62 | Returns the associated [TextEdit] node. |
| 63 | </description> |
| 64 | </method> |
| 65 | <method name="update_cache"> |
| 66 | <return type="void" /> |
| 67 | <description> |
| 68 | Clears then updates the [SyntaxHighlighter] caches. Override [method _update_cache] for a callback. |
| 69 | [b]Note:[/b] This is called automatically when the associated [TextEdit] node, updates its own cache. |
| 70 | </description> |
| 71 | </method> |
| 72 | </methods> |
| 73 | </class> |