123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- :github_url: hide
- .. DO NOT EDIT THIS FILE!!!
- .. Generated automatically from Godot engine sources.
- .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
- .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/SyntaxHighlighter.xml.
- .. _class_SyntaxHighlighter:
- SyntaxHighlighter
- =================
- **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
- **Inherited By:** :ref:`CodeHighlighter<class_CodeHighlighter>`, :ref:`EditorSyntaxHighlighter<class_EditorSyntaxHighlighter>`
- Base class for syntax highlighters. Provides syntax highlighting data to a :ref:`TextEdit<class_TextEdit>`.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- Base class for syntax highlighters. Provides syntax highlighting data to a :ref:`TextEdit<class_TextEdit>`. The associated :ref:`TextEdit<class_TextEdit>` will call into the **SyntaxHighlighter** on an as-needed basis.
- \ **Note:** A **SyntaxHighlighter** instance should not be used across multiple :ref:`TextEdit<class_TextEdit>` nodes.
- .. rst-class:: classref-reftable-group
- Methods
- -------
- .. table::
- :widths: auto
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`_clear_highlighting_cache<class_SyntaxHighlighter_private_method__clear_highlighting_cache>`\ (\ ) |virtual| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Dictionary<class_Dictionary>` | :ref:`_get_line_syntax_highlighting<class_SyntaxHighlighter_private_method__get_line_syntax_highlighting>`\ (\ line\: :ref:`int<class_int>`\ ) |virtual| |const| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`_update_cache<class_SyntaxHighlighter_private_method__update_cache>`\ (\ ) |virtual| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`clear_highlighting_cache<class_SyntaxHighlighter_method_clear_highlighting_cache>`\ (\ ) |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Dictionary<class_Dictionary>` | :ref:`get_line_syntax_highlighting<class_SyntaxHighlighter_method_get_line_syntax_highlighting>`\ (\ line\: :ref:`int<class_int>`\ ) |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`TextEdit<class_TextEdit>` | :ref:`get_text_edit<class_SyntaxHighlighter_method_get_text_edit>`\ (\ ) |const| |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`update_cache<class_SyntaxHighlighter_method_update_cache>`\ (\ ) |
- +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Method Descriptions
- -------------------
- .. _class_SyntaxHighlighter_private_method__clear_highlighting_cache:
- .. rst-class:: classref-method
- |void| **_clear_highlighting_cache**\ (\ ) |virtual| :ref:`🔗<class_SyntaxHighlighter_private_method__clear_highlighting_cache>`
- Virtual method which can be overridden to clear any local caches.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SyntaxHighlighter_private_method__get_line_syntax_highlighting:
- .. rst-class:: classref-method
- :ref:`Dictionary<class_Dictionary>` **_get_line_syntax_highlighting**\ (\ line\: :ref:`int<class_int>`\ ) |virtual| |const| :ref:`🔗<class_SyntaxHighlighter_private_method__get_line_syntax_highlighting>`
- Virtual method which can be overridden to return syntax highlighting data.
- See :ref:`get_line_syntax_highlighting<class_SyntaxHighlighter_method_get_line_syntax_highlighting>` for more details.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SyntaxHighlighter_private_method__update_cache:
- .. rst-class:: classref-method
- |void| **_update_cache**\ (\ ) |virtual| :ref:`🔗<class_SyntaxHighlighter_private_method__update_cache>`
- Virtual method which can be overridden to update any local caches.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SyntaxHighlighter_method_clear_highlighting_cache:
- .. rst-class:: classref-method
- |void| **clear_highlighting_cache**\ (\ ) :ref:`🔗<class_SyntaxHighlighter_method_clear_highlighting_cache>`
- Clears all cached syntax highlighting data.
- Then calls overridable method :ref:`_clear_highlighting_cache<class_SyntaxHighlighter_private_method__clear_highlighting_cache>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SyntaxHighlighter_method_get_line_syntax_highlighting:
- .. rst-class:: classref-method
- :ref:`Dictionary<class_Dictionary>` **get_line_syntax_highlighting**\ (\ line\: :ref:`int<class_int>`\ ) :ref:`🔗<class_SyntaxHighlighter_method_get_line_syntax_highlighting>`
- Returns the syntax highlighting data for the line at index ``line``. If the line is not cached, calls :ref:`_get_line_syntax_highlighting<class_SyntaxHighlighter_private_method__get_line_syntax_highlighting>` first to calculate the data.
- Each entry is a column number containing a nested :ref:`Dictionary<class_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 :ref:`Dictionary<class_Dictionary>` contains the data for that region. Currently only the key ``"color"`` is supported.
- \ **Example:** Possible return value. This means columns ``0`` to ``4`` should be red, and columns ``5`` to the end of the line should be green:
- ::
- {
- 0: {
- "color": Color(1, 0, 0)
- },
- 5: {
- "color": Color(0, 1, 0)
- }
- }
- .. rst-class:: classref-item-separator
- ----
- .. _class_SyntaxHighlighter_method_get_text_edit:
- .. rst-class:: classref-method
- :ref:`TextEdit<class_TextEdit>` **get_text_edit**\ (\ ) |const| :ref:`🔗<class_SyntaxHighlighter_method_get_text_edit>`
- Returns the associated :ref:`TextEdit<class_TextEdit>` node.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SyntaxHighlighter_method_update_cache:
- .. rst-class:: classref-method
- |void| **update_cache**\ (\ ) :ref:`🔗<class_SyntaxHighlighter_method_update_cache>`
- Clears then updates the **SyntaxHighlighter** caches. Override :ref:`_update_cache<class_SyntaxHighlighter_private_method__update_cache>` for a callback.
- \ **Note:** This is called automatically when the associated :ref:`TextEdit<class_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.)`
- .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
- .. |void| replace:: :abbr:`void (No return value.)`
|