:github_url: hide .. Generated automatically by doc/tools/make_rst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the SyntaxHighlighter.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_SyntaxHighlighter: SyntaxHighlighter ================= **Inherits:** :ref:`Resource` **<** :ref:`RefCounted` **<** :ref:`Object` **Inherited By:** :ref:`CodeHighlighter`, :ref:`EditorSyntaxHighlighter` Base Syntax highlighter resource for :ref:`TextEdit`. Description ----------- Base syntax highlighter resource all syntax highlighters extend from, provides syntax highlighting data to :ref:`TextEdit`. The associated :ref:`TextEdit` node will call into the ``SyntaxHighlighter`` on a as needed basis. \ **Note:** Each Syntax highlighter instance should not be shared across multiple :ref:`TextEdit` nodes. Methods ------- +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`_clear_highlighting_cache` **(** **)** |virtual| | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Dictionary` | :ref:`_get_line_syntax_highlighting` **(** :ref:`int` line **)** |virtual| |const| | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`_update_cache` **(** **)** |virtual| | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_highlighting_cache` **(** **)** | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Dictionary` | :ref:`get_line_syntax_highlighting` **(** :ref:`int` line **)** | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`TextEdit` | :ref:`get_text_edit` **(** **)** | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`update_cache` **(** **)** | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ Method Descriptions ------------------- .. _class_SyntaxHighlighter_method__clear_highlighting_cache: - void **_clear_highlighting_cache** **(** **)** |virtual| Virtual method which can be overridden to clear any local caches. ---- .. _class_SyntaxHighlighter_method__get_line_syntax_highlighting: - :ref:`Dictionary` **_get_line_syntax_highlighting** **(** :ref:`int` line **)** |virtual| |const| Virtual method which can be overridden to return syntax highlighting data. See :ref:`get_line_syntax_highlighting` for more details. ---- .. _class_SyntaxHighlighter_method__update_cache: - void **_update_cache** **(** **)** |virtual| Virtual method which can be overridden to update any local caches. ---- .. _class_SyntaxHighlighter_method_clear_highlighting_cache: - void **clear_highlighting_cache** **(** **)** Clears all cached syntax highlighting data. Then calls overridable method :ref:`_clear_highlighting_cache`. ---- .. _class_SyntaxHighlighter_method_get_line_syntax_highlighting: - :ref:`Dictionary` **get_line_syntax_highlighting** **(** :ref:`int` line **)** Returns syntax highlighting data for a single line. If the line is not cached, calls :ref:`_get_line_syntax_highlighting` to calculate the data. The return :ref:`Dictionary` is column number to :ref:`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 :ref:`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. ---- .. _class_SyntaxHighlighter_method_get_text_edit: - :ref:`TextEdit` **get_text_edit** **(** **)** Returns the associated :ref:`TextEdit` node. ---- .. _class_SyntaxHighlighter_method_update_cache: - void **update_cache** **(** **)** Clears then updates the ``SyntaxHighlighter`` caches. Override :ref:`_update_cache` for a callback. \ **Note:** This is called automatically when the associated :ref:`TextEdit` node, updates its own cache. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`