Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

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 (