class_syntaxhighlighter.rst 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/SyntaxHighlighter.xml.
  6. .. _class_SyntaxHighlighter:
  7. SyntaxHighlighter
  8. =================
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`CodeHighlighter<class_CodeHighlighter>`, :ref:`EditorSyntaxHighlighter<class_EditorSyntaxHighlighter>`
  11. Base class for syntax highlighters. Provides syntax highlighting data to a :ref:`TextEdit<class_TextEdit>`.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. 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.
  16. \ **Note:** A **SyntaxHighlighter** instance should not be used across multiple :ref:`TextEdit<class_TextEdit>` nodes.
  17. .. rst-class:: classref-reftable-group
  18. Methods
  19. -------
  20. .. table::
  21. :widths: auto
  22. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | void | :ref:`_clear_highlighting_cache<class_SyntaxHighlighter_private_method__clear_highlighting_cache>` **(** **)** |virtual| |
  24. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`Dictionary<class_Dictionary>` | :ref:`_get_line_syntax_highlighting<class_SyntaxHighlighter_private_method__get_line_syntax_highlighting>` **(** :ref:`int<class_int>` line **)** |virtual| |const| |
  26. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`_update_cache<class_SyntaxHighlighter_private_method__update_cache>` **(** **)** |virtual| |
  28. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | void | :ref:`clear_highlighting_cache<class_SyntaxHighlighter_method_clear_highlighting_cache>` **(** **)** |
  30. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_line_syntax_highlighting<class_SyntaxHighlighter_method_get_line_syntax_highlighting>` **(** :ref:`int<class_int>` line **)** |
  32. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`TextEdit<class_TextEdit>` | :ref:`get_text_edit<class_SyntaxHighlighter_method_get_text_edit>` **(** **)** |const| |
  34. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`update_cache<class_SyntaxHighlighter_method_update_cache>` **(** **)** |
  36. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. .. rst-class:: classref-section-separator
  38. ----
  39. .. rst-class:: classref-descriptions-group
  40. Method Descriptions
  41. -------------------
  42. .. _class_SyntaxHighlighter_private_method__clear_highlighting_cache:
  43. .. rst-class:: classref-method
  44. void **_clear_highlighting_cache** **(** **)** |virtual|
  45. Virtual method which can be overridden to clear any local caches.
  46. .. rst-class:: classref-item-separator
  47. ----
  48. .. _class_SyntaxHighlighter_private_method__get_line_syntax_highlighting:
  49. .. rst-class:: classref-method
  50. :ref:`Dictionary<class_Dictionary>` **_get_line_syntax_highlighting** **(** :ref:`int<class_int>` line **)** |virtual| |const|
  51. Virtual method which can be overridden to return syntax highlighting data.
  52. See :ref:`get_line_syntax_highlighting<class_SyntaxHighlighter_method_get_line_syntax_highlighting>` for more details.
  53. .. rst-class:: classref-item-separator
  54. ----
  55. .. _class_SyntaxHighlighter_private_method__update_cache:
  56. .. rst-class:: classref-method
  57. void **_update_cache** **(** **)** |virtual|
  58. Virtual method which can be overridden to update any local caches.
  59. .. rst-class:: classref-item-separator
  60. ----
  61. .. _class_SyntaxHighlighter_method_clear_highlighting_cache:
  62. .. rst-class:: classref-method
  63. void **clear_highlighting_cache** **(** **)**
  64. Clears all cached syntax highlighting data.
  65. Then calls overridable method :ref:`_clear_highlighting_cache<class_SyntaxHighlighter_private_method__clear_highlighting_cache>`.
  66. .. rst-class:: classref-item-separator
  67. ----
  68. .. _class_SyntaxHighlighter_method_get_line_syntax_highlighting:
  69. .. rst-class:: classref-method
  70. :ref:`Dictionary<class_Dictionary>` **get_line_syntax_highlighting** **(** :ref:`int<class_int>` line **)**
  71. Returns syntax highlighting data for a single line. If the line is not cached, calls :ref:`_get_line_syntax_highlighting<class_SyntaxHighlighter_private_method__get_line_syntax_highlighting>` to calculate the data.
  72. The return :ref:`Dictionary<class_Dictionary>` is column number to :ref:`Dictionary<class_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<class_Dictionary>` contains the data for that region, currently only the key "color" is supported.
  73. \ **Example return:**\
  74. ::
  75. var color_map = {
  76. 0: {
  77. "color": Color(1, 0, 0)
  78. },
  79. 5: {
  80. "color": Color(0, 1, 0)
  81. }
  82. }
  83. This will color columns 0-4 red, and columns 5-eol in green.
  84. .. rst-class:: classref-item-separator
  85. ----
  86. .. _class_SyntaxHighlighter_method_get_text_edit:
  87. .. rst-class:: classref-method
  88. :ref:`TextEdit<class_TextEdit>` **get_text_edit** **(** **)** |const|
  89. Returns the associated :ref:`TextEdit<class_TextEdit>` node.
  90. .. rst-class:: classref-item-separator
  91. ----
  92. .. _class_SyntaxHighlighter_method_update_cache:
  93. .. rst-class:: classref-method
  94. void **update_cache** **(** **)**
  95. Clears then updates the **SyntaxHighlighter** caches. Override :ref:`_update_cache<class_SyntaxHighlighter_private_method__update_cache>` for a callback.
  96. \ **Note:** This is called automatically when the associated :ref:`TextEdit<class_TextEdit>` node, updates its own cache.
  97. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  98. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  99. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  100. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  101. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  102. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  103. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`