2
0

class_syntaxhighlighter.rst 7.9 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 Syntax highlighter resource for :ref:`TextEdit<class_TextEdit>`.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. Base syntax highlighter resource all syntax highlighters extend from, provides syntax highlighting data to :ref:`TextEdit<class_TextEdit>`.
  16. The associated :ref:`TextEdit<class_TextEdit>` node will call into the **SyntaxHighlighter** on a as needed basis.
  17. \ **Note:** Each Syntax highlighter instance should not be shared across multiple :ref:`TextEdit<class_TextEdit>` nodes.
  18. .. rst-class:: classref-reftable-group
  19. Methods
  20. -------
  21. .. table::
  22. :widths: auto
  23. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | void | :ref:`_clear_highlighting_cache<class_SyntaxHighlighter_method__clear_highlighting_cache>` **(** **)** |virtual| |
  25. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`Dictionary<class_Dictionary>` | :ref:`_get_line_syntax_highlighting<class_SyntaxHighlighter_method__get_line_syntax_highlighting>` **(** :ref:`int<class_int>` line **)** |virtual| |const| |
  27. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | void | :ref:`_update_cache<class_SyntaxHighlighter_method__update_cache>` **(** **)** |virtual| |
  29. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`clear_highlighting_cache<class_SyntaxHighlighter_method_clear_highlighting_cache>` **(** **)** |
  31. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_line_syntax_highlighting<class_SyntaxHighlighter_method_get_line_syntax_highlighting>` **(** :ref:`int<class_int>` line **)** |
  33. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`TextEdit<class_TextEdit>` | :ref:`get_text_edit<class_SyntaxHighlighter_method_get_text_edit>` **(** **)** |
  35. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | void | :ref:`update_cache<class_SyntaxHighlighter_method_update_cache>` **(** **)** |
  37. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. .. rst-class:: classref-section-separator
  39. ----
  40. .. rst-class:: classref-descriptions-group
  41. Method Descriptions
  42. -------------------
  43. .. _class_SyntaxHighlighter_method__clear_highlighting_cache:
  44. .. rst-class:: classref-method
  45. void **_clear_highlighting_cache** **(** **)** |virtual|
  46. Virtual method which can be overridden to clear any local caches.
  47. .. rst-class:: classref-item-separator
  48. ----
  49. .. _class_SyntaxHighlighter_method__get_line_syntax_highlighting:
  50. .. rst-class:: classref-method
  51. :ref:`Dictionary<class_Dictionary>` **_get_line_syntax_highlighting** **(** :ref:`int<class_int>` line **)** |virtual| |const|
  52. Virtual method which can be overridden to return syntax highlighting data.
  53. See :ref:`get_line_syntax_highlighting<class_SyntaxHighlighter_method_get_line_syntax_highlighting>` for more details.
  54. .. rst-class:: classref-item-separator
  55. ----
  56. .. _class_SyntaxHighlighter_method__update_cache:
  57. .. rst-class:: classref-method
  58. void **_update_cache** **(** **)** |virtual|
  59. Virtual method which can be overridden to update any local caches.
  60. .. rst-class:: classref-item-separator
  61. ----
  62. .. _class_SyntaxHighlighter_method_clear_highlighting_cache:
  63. .. rst-class:: classref-method
  64. void **clear_highlighting_cache** **(** **)**
  65. Clears all cached syntax highlighting data.
  66. Then calls overridable method :ref:`_clear_highlighting_cache<class_SyntaxHighlighter_method__clear_highlighting_cache>`.
  67. .. rst-class:: classref-item-separator
  68. ----
  69. .. _class_SyntaxHighlighter_method_get_line_syntax_highlighting:
  70. .. rst-class:: classref-method
  71. :ref:`Dictionary<class_Dictionary>` **get_line_syntax_highlighting** **(** :ref:`int<class_int>` line **)**
  72. Returns syntax highlighting data for a single line. If the line is not cached, calls :ref:`_get_line_syntax_highlighting<class_SyntaxHighlighter_method__get_line_syntax_highlighting>` to calculate the data.
  73. 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.
  74. \ **Example return:**\
  75. ::
  76. var color_map = {
  77. 0: {
  78. "color": Color(1, 0, 0)
  79. },
  80. 5: {
  81. "color": Color(0, 1, 0)
  82. }
  83. }
  84. This will color columns 0-4 red, and columns 5-eol in green.
  85. .. rst-class:: classref-item-separator
  86. ----
  87. .. _class_SyntaxHighlighter_method_get_text_edit:
  88. .. rst-class:: classref-method
  89. :ref:`TextEdit<class_TextEdit>` **get_text_edit** **(** **)**
  90. Returns the associated :ref:`TextEdit<class_TextEdit>` node.
  91. .. rst-class:: classref-item-separator
  92. ----
  93. .. _class_SyntaxHighlighter_method_update_cache:
  94. .. rst-class:: classref-method
  95. void **update_cache** **(** **)**
  96. Clears then updates the **SyntaxHighlighter** caches. Override :ref:`_update_cache<class_SyntaxHighlighter_method__update_cache>` for a callback.
  97. \ **Note:** This is called automatically when the associated :ref:`TextEdit<class_TextEdit>` node, updates its own cache.
  98. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  99. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  100. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  101. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  102. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  103. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`