SyntaxHighlighter.xml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="SyntaxHighlighter" inherits="Resource" version="4.0">
  3. <brief_description>
  4. Base Syntax highlighter resource for [TextEdit].
  5. </brief_description>
  6. <description>
  7. Base syntax highlighter resource all syntax highlighters extend from, provides syntax highlighting data to [TextEdit].
  8. The associated [TextEdit] node will call into the [SyntaxHighlighter] on a as needed basis.
  9. [b]Note:[/b] Each Syntax highlighter instance should not be shared across multiple [TextEdit] nodes.
  10. </description>
  11. <tutorials>
  12. </tutorials>
  13. <methods>
  14. <method name="_clear_highlighting_cache" qualifiers="virtual">
  15. <return type="void" />
  16. <description>
  17. Virtual method which can be overridden to clear any local caches.
  18. </description>
  19. </method>
  20. <method name="_get_line_syntax_highlighting" qualifiers="virtual const">
  21. <return type="Dictionary" />
  22. <argument index="0" name="line" type="int" />
  23. <description>
  24. Virtual method which can be overridden to return syntax highlighting data.
  25. See [method get_line_syntax_highlighting] for more details.
  26. </description>
  27. </method>
  28. <method name="_update_cache" qualifiers="virtual">
  29. <return type="void" />
  30. <description>
  31. Virtual method which can be overridden to update any local caches.
  32. </description>
  33. </method>
  34. <method name="clear_highlighting_cache">
  35. <return type="void" />
  36. <description>
  37. Clears all cached syntax highlighting data.
  38. Then calls overridable method [method _clear_highlighting_cache].
  39. </description>
  40. </method>
  41. <method name="get_line_syntax_highlighting">
  42. <return type="Dictionary" />
  43. <argument index="0" name="line" type="int" />
  44. <description>
  45. Returns syntax highlighting data for a single line. If the line is not cached, calls [method _get_line_syntax_highlighting] to calculate the data.
  46. The return [Dictionary] is column number to [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 [Dictionary] contains the data for that region, currently only the key "color" is supported.
  47. [b]Example return:[/b]
  48. [codeblock]
  49. var color_map = {
  50. 0: {
  51. "color": Color(1, 0, 0)
  52. },
  53. 5: {
  54. "color": Color(0, 1, 0)
  55. }
  56. }
  57. [/codeblock]
  58. This will color columns 0-4 red, and columns 5-eol in green.
  59. </description>
  60. </method>
  61. <method name="get_text_edit">
  62. <return type="TextEdit" />
  63. <description>
  64. Returns the associated [TextEdit] node.
  65. </description>
  66. </method>
  67. <method name="update_cache">
  68. <return type="void" />
  69. <description>
  70. Clears then updates the [SyntaxHighlighter] caches. Override [method _update_cache] for a callback.
  71. [b]Note:[/b] This is called automatically when the associated [TextEdit] node, updates its own cache.
  72. </description>
  73. </method>
  74. </methods>
  75. </class>