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.

CodeEdit

Inherits: TextEdit < Control < CanvasItem < Node < Object

A multiline text editor designed for editing code.

Description

CodeEdit is a specialized TextEdit designed for editing plain text code files. It has many features commonly found in code editors such as line numbers, line folding, code completion, indent management, and string/comment management.

Note: Regardless of locale, CodeEdit will by default always use left-to-right text direction to correctly display source code.

Properties

bool

auto_brace_completion_enabled

false

bool

auto_brace_completion_highlight_matching

false

Dictionary

auto_brace_completion_pairs

{ "\"": "\"", "'": "'", "(": ")", "[": "]", "{": "}" }

bool

code_completion_enabled

false

String[]

code_completion_prefixes

[]

String[]

delimiter_comments

[]

String[]

delimiter_strings

["' '", "\" \""]

bool

gutters_draw_bookmarks

false

bool

gutters_draw_breakpoints_gutter

false

bool

gutters_draw_executing_lines

false

bool

gutters_draw_fold_gutter

false

bool

gutters_draw_line_numbers

false

bool

gutters_zero_pad_line_numbers

false

bool

indent_automatic

false

String[]

indent_automatic_prefixes

[":", "{", "[", "("]

int

indent_size

4

bool

indent_use_spaces

false

LayoutDirection

layout_direction

2 (overrides Control)

bool

line_folding

false

int[]

line_length_guidelines

[]

bool

symbol_lookup_on_click

false

TextDirection

text_direction

1 (overrides TextEdit)

Methods

void

_confirm_code_completion ( bool replace ) virtual

Dictionary[]

_filter_code_completion_candidates ( Dictionary[] candidates ) virtual const

void

_request_code_completion ( bool force ) virtual

void

add_auto_brace_completion_pair ( String start_key, String end_key )

void

add_code_completion_option ( CodeCompletionKind type, String display_text, String insert_text, Color text_color=Color(1, 1, 1, 1), Resource icon=null, Variant value=0, int location=1024 )

void

add_comment_delimiter ( String start_key, String end_key, bool line_only=false )

void

add_string_delimiter ( String start_key, String end_key, bool line_only=false )

bool

can_fold_line ( int line ) const

void

cancel_code_completion ( )

void

clear_bookmarked_lines ( )

void

clear_breakpointed_lines ( )

void

clear_comment_delimiters ( )

void

clear_executing_lines ( )

void

clear_string_delimiters ( )

void

confirm_code_completion ( bool replace=false )

void

convert_indent ( int from_line=-1, int to_line=-1 )

void

create_code_region ( )

void

do_indent ( )

void

duplicate_lines ( )

void

fold_all_lines ( )

void

fold_line ( int line )

String

get_auto_brace_completion_close_key ( String open_key ) const

PackedInt32Array

get_bookmarked_lines ( ) const

PackedInt32Array

get_breakpointed_lines ( ) const

Dictionary

get_code_completion_option ( int index ) const

Dictionary[]

get_code_completion_options ( ) const

int

get_code_completion_selected_index ( ) const

String

get_code_region_end_tag ( ) const

String

get_code_region_start_tag ( ) const

String

get_delimiter_end_key ( int delimiter_index ) const

Vector2

get_delimiter_end_position ( int line, int column ) const

String

get_delimiter_start_key ( int delimiter_index ) const

Vector2

get_delimiter_start_position ( int line, int column ) const

PackedInt32Array

get_executing_lines ( ) const

int[]

get_folded_lines ( ) const

String

get_text_for_code_completion ( ) const

String

get_text_for_symbol_lookup ( ) const

String

get_text_with_cursor_char ( int line, int column ) const

bool

has_auto_brace_completion_close_key ( String close_key ) const

bool

has_auto_brace_completion_open_key ( String open_key ) const

bool

has_comment_delimiter ( String start_key ) const

bool

has_string_delimiter ( String start_key ) const

void

indent_lines ( )

int

is_in_comment ( int line, int column=-1 ) const

int

is_in_string ( int line, int column=-1 ) const

bool

is_line_bookmarked ( int line ) const

bool

is_line_breakpointed ( int line ) const

bool

is_line_code_region_end ( int line ) const

bool

is_line_code_region_start ( int line ) const

bool

is_line_executing ( int line ) const

bool

is_line_folded ( int line ) const

void

remove_comment_delimiter ( String start_key )

void

remove_string_delimiter ( String start_key )

void

request_code_completion ( bool force=false )

void

set_code_completion_selected_index ( int index )

void

set_code_hint ( String code_hint )

void

set_code_hint_draw_below ( bool draw_below )

void

set_code_region_tags ( String start="region", String end="endregion" )

void

set_line_as_bookmarked ( int line, bool bookmarked )

void

set_line_as_breakpoint ( int line, bool breakpointed )

void

set_line_as_executing ( int line, bool executing )

void

set_symbol_lookup_word_as_valid ( bool valid )

void

toggle_foldable_line ( int line )

void

unfold_all_lines ( )

void

unfold_line ( int line )

void

unindent_lines ( )

void

update_code_completion_options ( bool force )

Theme Properties

Color

bookmark_color

Color(0.5, 0.64, 1, 0.8)

Color

brace_mismatch_color

Color(1, 0.2, 0.2, 1)

Color

breakpoint_color

Color(0.9, 0.29, 0.3, 1)

Color

code_folding_color

Color(0.8, 0.8, 0.8, 0.8)