Files
godot-docs-l10n/classes/es/class_syntaxhighlighter.rst
2025-12-19 14:34:07 +01:00

166 lines
8.9 KiB
ReStructuredText

:github_url: hide
.. _class_SyntaxHighlighter:
SyntaxHighlighter
=================
**Hereda:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
**Heredado por:** :ref:`CodeHighlighter<class_CodeHighlighter>`, :ref:`EditorSyntaxHighlighter<class_EditorSyntaxHighlighter>`
Clase base para los resaltadores de sintaxis. Proporciona datos de resaltado de sintaxis a un :ref:`TextEdit<class_TextEdit>`.
.. rst-class:: classref-introduction-group
Descripción
----------------------
Clase base para los resaltadores de sintaxis. Proporciona datos de resaltado de sintaxis a un :ref:`TextEdit<class_TextEdit>`. El :ref:`TextEdit<class_TextEdit>` asociado llamará al **SyntaxHighlighter** cuando sea necesario.
\ **Nota:** Una instancia de **SyntaxHighlighter** no debe ser usada a través de múltiples nodos :ref:`TextEdit<class_TextEdit>`.
.. rst-class:: classref-reftable-group
Métodos
--------------
.. 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
Descripciones de Métodos
------------------------------------------------
.. _class_SyntaxHighlighter_private_method__clear_highlighting_cache:
.. rst-class:: classref-method
|void| **_clear_highlighting_cache**\ (\ ) |virtual| :ref:`🔗<class_SyntaxHighlighter_private_method__clear_highlighting_cache>`
Método virtual que puede ser sobreescrito para limpiar cualquier caché local.
.. 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>`
Método virtual que puede ser sobreescrito para devolver datos de resaltado de sintaxis.
Véase :ref:`get_line_syntax_highlighting()<class_SyntaxHighlighter_method_get_line_syntax_highlighting>` para más detalles.
.. 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>`
Método virtual que puede ser sobreescrito para actualizar cualquier caché local.
.. 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>`
Limpia todos los datos de resaltado de sintaxis cacheados.
Luego llama al método sobrescribible :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>`
Devuelve el nodo :ref:`TextEdit<class_TextEdit>` asociado.
.. rst-class:: classref-item-separator
----
.. _class_SyntaxHighlighter_method_update_cache:
.. rst-class:: classref-method
|void| **update_cache**\ (\ ) :ref:`🔗<class_SyntaxHighlighter_method_update_cache>`
Limpia y luego actualiza las cachés de **SyntaxHighlighter**. Sobrescribe :ref:`_update_cache()<class_SyntaxHighlighter_private_method__update_cache>` para una devolución de llamada.
\ **Nota:** Esto se llama automáticamente cuando el nodo :ref:`TextEdit<class_TextEdit>` asociado actualiza su propia caché.
.. |virtual| replace:: :abbr:`virtual (Normalmente, este método debería ser sobreescrito por el usuario para que tenga algún efecto.)`
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
.. |const| replace:: :abbr:`const (Este método no tiene efectos secundarios. No modifica ninguna de las variables miembro de la instancia.)`
.. |vararg| replace:: :abbr:`vararg (Este método permite agregar cualquier número de argumentos después de los descritos aquí.)`
.. |constructor| replace:: :abbr:`constructor (Este método se utiliza para construir un tipo.)`
.. |static| replace:: :abbr:`static (Este método no necesita una instancia para ser llamado, por lo que puede llamarse directamente utilizando el nombre de la clase.)`
.. |operator| replace:: :abbr:`operator (Este método describe un operador válido para usar con este tipo como operando izquierdo.)`
.. |bitfield| replace:: :abbr:`BitField (Este valor es un entero compuesto como una máscara de bits de las siguientes banderas.)`
.. |void| replace:: :abbr:`void (Sin valor de retorno.)`