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