Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

SyntaxHighlighter

Hérite de : Resource < RefCounted < Object

Hérité par : CodeHighlighter, EditorSyntaxHighlighter

Base class for syntax highlighters. Provides syntax highlighting data to a TextEdit.

Description

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.

Méthodes

void

_clear_highlighting_cache() virtual

Dictionary

_get_line_syntax_highlighting(line: int) virtual const

void

_update_cache() virtual

void

clear_highlighting_cache()

Dictionary

get_line_syntax_highlighting(line: int)

TextEdit

get_text_edit() const

void

update_cache()


Descriptions des méthodes

void _clear_highlighting_cache() virtual 🔗

Méthode virtuelle qui peut être surchargée pour nettoyer certains caches locaux.


Dictionary _get_line_syntax_highlighting(line: int) virtual const 🔗

Méthode virtuelle qui peut être redéfinie pour renvoyer des données de syntaxe.

Voir get_line_syntax_highlighting() pour plus de détails.


void _update_cache() virtual 🔗

Méthode virtuelle qui peut être surchargée pour mettre à jour les caches locaux.


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 the syntax highlighting data for the line at index line. If the line is not cached, calls _get_line_syntax_highlighting() first to calculate the data.

Each entry is a column number containing a nested Dictionary. The column number denotes 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: Possible return value. This means columns 0 to 4 should be red, and columns 5 to the end of the line should be green:

{
    0: {
        "color": Color(1, 0, 0)
    },
    5: {
        "color": Color(0, 1, 0)
    }
}

TextEdit get_text_edit() const 🔗

Renvoie le nœud TextEdit associé.


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.