class_syntaxhighlighter.rst 7.2 KB

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