SyntaxHighlighter
继承: Resource
< RefCounted
< Object
派生: CodeHighlighter
, EditorSyntaxHighlighter
Base class for syntax highlighters. Provides syntax highlighting data to a TextEdit
.
描述
Base class for syntax highlighters. Provides syntax highlighting data to a TextEdit
. The associated TextEdit
will call into the SyntaxHighlighter on an as-needed basis.
Note: A SyntaxHighlighter instance should not be used across multiple TextEdit
nodes.
方法
void | _clear_highlighting_cache ( ) virtual1 |
Dictionary | _get_line_syntax_highlighting ( line: int ) virtual1 const2 |
void | _update_cache ( ) virtual1 |
void | clear_highlighting_cache ( ) |
Dictionary | get_line_syntax_highlighting ( line: int ) |
TextEdit | get_text_edit ( ) const2 |
void | update_cache ( ) |
方法说明
void
_clear_highlighting_cache ( ) virtual1
Virtual method which can be overridden to clear any local caches.
Dictionary
_get_line_syntax_highlighting ( line: int
) virtual1 const2
Virtual method which can be overridden to return syntax highlighting data.
See get_line_syntax_highlighting
for more details.
void
_update_cache ( ) virtual1
Virtual method which can be overridden to update any local caches.
void
clear_highlighting_cache ( )
Clears all cached syntax highlighting data.
Then calls overridable method _clear_highlighting_cache
.
Dictionary
get_line_syntax_highlighting ( line: int
)
Returns syntax highlighting data for a single line. If the line is not cached, calls _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.
Example return:
var color_map = {
0: {
"color": Color(1, 0, 0)
},
5: {
"color": Color(0, 1, 0)
}
}
This will color columns 0-4 red, and columns 5-eol in green.
TextEdit
get_text_edit ( ) const2
Returns the associated TextEdit
node.
void
update_cache ( )
Clears then updates the SyntaxHighlighter caches. Override _update_cache
for a callback.
Note: This is called automatically when the associated TextEdit
node, updates its own cache.
本方法通常需要用户覆盖才能生效。
本方法无副作用,不会修改该实例的任何成员变量。
本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。
本方法用于构造某个类型。
调用本方法无需实例,可直接使用类名进行调用。
本方法描述的是使用本类型作为左操作数的有效运算符。
这个值是由下列位标志构成位掩码的整数。
无返回值。