Index · Object → Node → CanvasItem → Control → TextEdit → CodeEdit

CodeEdit

A multiline text editor designed for editing code.

Class 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

var auto_brace_completion_enabled: bool = false

If true, uses auto_brace_completion_pairs to automatically insert the closing brace when the opening brace is inserted by typing or autocompletion. Also automatically removes the closing brace when using backspace on the opening brace.

var auto_brace_completion_highlight_matching: bool = false

If true, highlights brace pairs when the caret is on either one, using auto_brace_completion_pairs. If matching, the pairs will be underlined. If a brace is unmatched, it is colored with brace_mismatch_color.

var auto_brace_completion_pairs: Dictionary = { "\"": "\"", "'": "'", "(": ")", "[": "]", "{": "}" }

Sets the brace pairs to be autocompleted. For each entry in the dictionary, the key is the opening brace and the value is the closing brace that matches it. A brace is a String made of symbols. See auto_brace_completion_enabled and auto_brace_completion_highlight_matching.

var code_completion_enabled: bool = false

If true, the ProjectSettings.input/ui_text_completion_query action requests code completion. To handle it, see _request_code_completion() or code_completion_requested.

var code_completion_prefixes: String[] = []

Sets prefixes that will trigger code completion.

var delimiter_comments: String[] = []

Sets the comment delimiters. All existing comment delimiters will be removed.

var delimiter_strings: String[] = ["' '", "\" \""]

Sets the string delimiters. All existing string delimiters will be removed.

var gutters_draw_bookmarks: bool = false

If true, bookmarks are drawn in the gutter. This gutter is shared with breakpoints and executing lines. See set_line_as_bookmarked().

var gutters_draw_breakpoints_gutter: bool = false

If true, breakpoints are drawn in the gutter. This gutter is shared with bookmarks and executing lines. Clicking the gutter will toggle the breakpoint for the line, see set_line_as_breakpoint().

var gutters_draw_executing_lines: bool = false

If true, executing lines are marked in the gutter. This gutter is shared with breakpoints and bookmarks. See set_line_as_executing().

var gutters_draw_fold_gutter: bool = false

If true, the fold gutter is drawn. In this gutter, the can_fold_code_region icon is drawn for each foldable line (see can_fold_line()) and the folded_code_region icon is drawn for each folded line (see is_line_folded()). These icons can be clicked to toggle the fold state, see toggle_foldable_line(). line_folding must be true to show icons.

var gutters_draw_line_numbers: bool = false

If true, the line number gutter is drawn. Line numbers start at 1 and are incremented for each line of text. Clicking and dragging in the line number gutter will select entire lines of text.

var gutters_line_numbers_min_digits: int = 3

The minimum width in digits reserved for the line number gutter.

var gutters_zero_pad_line_numbers: bool = false

If true, line numbers drawn in the gutter are zero padded based on the total line count. Requires gutters_draw_line_numbers to be set to true.

var indent_automatic: bool = false

If true, an extra indent is automatically inserted when a new line is added and a prefix in indent_automatic_prefixes is found. If a brace pair opening key is found, the matching closing brace will be moved to another new line (see auto_brace_completion_pairs).

var indent_automatic_prefixes: String[] = [":", "{", "[", "("]

Prefixes to trigger an automatic indent. Used when indent_automatic is set to true.

var indent_size: int = 4

Size of the tabulation indent (one Tab press) in characters. If indent_use_spaces is enabled the number of spaces to use.

var indent_use_spaces: bool = false

Use spaces instead of tabs for indentation.

var layout_direction: Control.LayoutDirection = 2
var line_folding: bool = false

If true, lines can be folded. Otherwise, line folding methods like fold_line() will not work and can_fold_line() will always return false. See gutters_draw_fold_gutter.

var line_length_guidelines: int[] = []

Draws vertical lines at the provided columns. The first entry is considered a main hard guideline and is drawn more prominently.

var symbol_lookup_on_click: bool = false

Set when a validated word from symbol_validate is clicked, the symbol_lookup should be emitted.

var symbol_tooltip_on_hover: bool = false

If true, the symbol_hovered signal is emitted when hovering over a word.

var text_direction: Control.TextDirection = 1
Inherited from TextEdit (49)
var caret_multiple: bool = true
var draw_spaces: bool = false
var draw_tabs: bool = false
var editable: bool = true
var language: String = ""
var minimap_draw: bool = false
var minimap_width: int = 80
var scroll_smooth: bool = false
var tab_input_mode: bool = true
var text: String = ""
Inherited from Control (62)
var accessibility_controls_nodes: NodePath[] = []
var accessibility_flow_to_nodes: NodePath[] = []
var accessibility_labeled_by_nodes: NodePath[] = []
var anchor_bottom: float = 0.0
var anchor_left: float = 0.0
var anchor_right: float = 0.0
var anchor_top: float = 0.0
var clip_contents: bool = false
var custom_maximum_size: Vector2 = Vector2(-1, -1)
var custom_minimum_size: Vector2 = Vector2(0, 0)
var focus_neighbor_bottom: NodePath = NodePath("")
var focus_neighbor_left: NodePath = NodePath("")
var focus_neighbor_right: NodePath = NodePath("")
var focus_neighbor_top: NodePath = NodePath("")
var focus_next: NodePath = NodePath("")
var focus_previous: NodePath = NodePath("")
var offset_bottom: float = 0.0
var offset_left: float = 0.0
var offset_right: float = 0.0
var offset_top: float = 0.0
var offset_transform_pivot: Vector2 = Vector2(0, 0)
var offset_transform_pivot_ratio: Vector2 = Vector2(0.5, 0.5)
var offset_transform_position: Vector2 = Vector2(0, 0)
var offset_transform_scale: Vector2 = Vector2(1, 1)
var pivot_offset: Vector2 = Vector2(0, 0)
var pivot_offset_ratio: Vector2 = Vector2(0, 0)
var position: Vector2 = Vector2(0, 0)
var rotation: float = 0.0
var scale: Vector2 = Vector2(1, 1)
var size: Vector2 = Vector2(0, 0)
Inherited from CanvasItem (16)
var light_mask: int = 1
var modulate: Color = Color(1, 1, 1, 1)
var self_modulate: Color = Color(1, 1, 1, 1)
var top_level: bool = false
var visible: bool = true
var y_sort_enabled: bool = false
var z_as_relative: bool = true
var z_index: int = 0
Inherited from Node (14)
var owner: Node

Methods

func _confirm_code_completion(replace: bool) -> void

Override this method to define how the selected entry should be inserted. If replace is true, any existing text should be replaced.

func _filter_code_completion_candidates(candidates: Dictionary[]) -> Dictionary[]

Override this method to define what items in candidates should be displayed.

Both candidates and the return is an Array of Dictionary, see get_code_completion_option() for Dictionary content.

func _request_code_completion(force: bool) -> void

Override this method to define what happens when the user requests code completion. If force is true, any checks should be bypassed.

func add_auto_brace_completion_pair(start_key: String, end_key: String) -> void

Adds a brace pair.

Both the start and end keys must be symbols. Only the start key has to be unique.

func add_code_completion_option(type: CodeEdit.CodeCompletionKind, display_text: String, insert_text: String, text_color: Color = Color(1, 1, 1, 1), icon: Resource = null, value: Variant = null, location: int = 1024) -> void

Submits an item to the queue of potential candidates for the autocomplete menu. Call update_code_completion_options() to update the list.

location indicates location of the option relative to the location of the code completion query. See CodeCompletionLocation for how to set this value.

Note: This list will replace all current candidates.

func add_comment_delimiter(start_key: String, end_key: String, line_only: bool = false) -> void

Adds a comment delimiter from start_key to end_key. Both keys should be symbols, and start_key must not be shared with other delimiters.

If line_only is true or end_key is an empty String, the region does not carry over to the next line.

func add_string_delimiter(start_key: String, end_key: String, line_only: bool = false) -> void

Defines a string delimiter from start_key to end_key. Both keys should be symbols, and start_key must not be shared with other delimiters.

If line_only is true or end_key is an empty String, the region does not carry over to the next line.

func can_fold_line(line: int) -> bool

Returns true if the given line is foldable. A line is foldable if it is the start of a valid code region (see get_code_region_start_tag()), if it is the start of a comment or string block, or if the next non-empty line is more indented (see TextEdit.get_indent_level()).

func cancel_code_completion() -> void

Cancels the autocomplete menu.

func clear_bookmarked_lines() -> void

Clears all bookmarked lines.

func clear_breakpointed_lines() -> void

Clears all breakpointed lines.

func clear_comment_delimiters() -> void

Removes all comment delimiters.

func clear_executing_lines() -> void

Clears all executed lines.

func clear_string_delimiters() -> void

Removes all string delimiters.

func confirm_code_completion(replace: bool = false) -> void

Inserts the selected entry into the text. If replace is true, any existing text is replaced rather than merged.

func convert_indent(from_line: int = -1, to_line: int = -1) -> void

Converts the indents of lines between from_line and to_line to tabs or spaces as set by indent_use_spaces.

Values of -1 convert the entire text.

func create_code_region() -> void

Creates a new code region with the selection. At least one single line comment delimiter have to be defined (see add_comment_delimiter()).

A code region is a part of code that is highlighted when folded and can help organize your script.

Code region start and end tags can be customized (see set_code_region_tags()).

Code regions are delimited using start and end tags (respectively region and endregion by default) preceded by one line comment delimiter. (eg. #region and #endregion)

func delete_lines() -> void

Deletes all lines that are selected or have a caret on them.

func do_indent() -> void

If there is no selection, indentation is inserted at the caret. Otherwise, the selected lines are indented like indent_lines(). Equivalent to the ProjectSettings.input/ui_text_indent action. The indentation characters used depend on indent_use_spaces and indent_size.

func duplicate_lines() -> void

Duplicates all lines currently selected with any caret. Duplicates the entire line beneath the current one no matter where the caret is within the line.

func duplicate_selection() -> void

Duplicates all selected text and duplicates all lines with a caret on them.

func fold_all_lines() -> void

Folds all lines that are possible to be folded (see can_fold_line()).

func fold_line(line: int) -> void

Folds the given line, if possible (see can_fold_line()).

func get_auto_brace_completion_close_key(open_key: String) -> String

Gets the matching auto brace close key for open_key.

func get_bookmarked_lines() -> PackedInt32Array

Gets all bookmarked lines.

func get_breakpointed_lines() -> PackedInt32Array

Gets all breakpointed lines.

func get_code_completion_option(index: int) -> Dictionary

Gets the completion option at index. The return Dictionary has the following key-values:

kind: CodeCompletionKind

display_text: Text that is shown on the autocomplete menu.

insert_text: Text that is to be inserted when this item is selected.

font_color: Color of the text on the autocomplete menu.

icon: Icon to draw on the autocomplete menu.

default_value: Value of the symbol.

func get_code_completion_options() -> Dictionary[]

Gets all completion options, see get_code_completion_option() for return content.

func get_code_completion_selected_index() -> int

Gets the index of the current selected completion option.

func get_code_region_end_tag() -> String

Returns the code region end tag (without comment delimiter).

func get_code_region_start_tag() -> String

Returns the code region start tag (without comment delimiter).

func get_delimiter_end_key(delimiter_index: int) -> String

Gets the end key for a string or comment region index.

func get_delimiter_end_position(line: int, column: int) -> Vector2

If line column is in a string or comment, returns the end position of the region. If not or no end could be found, both Vector2 values will be -1.

func get_delimiter_start_key(delimiter_index: int) -> String

Gets the start key for a string or comment region index.

func get_delimiter_start_position(line: int, column: int) -> Vector2

If line column is in a string or comment, returns the start position of the region. If not or no start could be found, both Vector2 values will be -1.

func get_executing_lines() -> PackedInt32Array

Gets all executing lines.

func get_folded_lines() -> int[]

Returns all lines that are currently folded.

func get_text_for_code_completion() -> String

Returns the full text with char 0xFFFF at the caret location.

func get_text_for_symbol_lookup() -> String

Returns the full text with char 0xFFFF at the cursor location.

func get_text_with_cursor_char(line: int, column: int) -> String

Returns the full text with char 0xFFFF at the specified location.

func has_auto_brace_completion_close_key(close_key: String) -> bool

Returns true if close key close_key exists.

func has_auto_brace_completion_open_key(open_key: String) -> bool

Returns true if open key open_key exists.

func has_comment_delimiter(start_key: String) -> bool

Returns true if comment start_key exists.

func has_string_delimiter(start_key: String) -> bool

Returns true if string start_key exists.

func indent_lines() -> void

Indents all lines that are selected or have a caret on them. Uses spaces or a tab depending on indent_use_spaces. See unindent_lines().

func is_in_comment(line: int, column: int = -1) -> int

Returns delimiter index if line column is in a comment. If column is not provided, will return delimiter index if the entire line is a comment. Otherwise -1.

func is_in_string(line: int, column: int = -1) -> int

Returns the delimiter index if line column is in a string. If column is not provided, will return the delimiter index if the entire line is a string. Otherwise -1.

func is_line_bookmarked(line: int) -> bool

Returns true if the given line is bookmarked. See set_line_as_bookmarked().

func is_line_breakpointed(line: int) -> bool

Returns true if the given line is breakpointed. See set_line_as_breakpoint().

func is_line_code_region_end(line: int) -> bool

Returns true if the given line is a code region end. See set_code_region_tags().

func is_line_code_region_start(line: int) -> bool

Returns true if the given line is a code region start. See set_code_region_tags().

func is_line_executing(line: int) -> bool

Returns true if the given line is marked as executing. See set_line_as_executing().

func is_line_folded(line: int) -> bool

Returns true if the given line is folded. See fold_line().

func join_lines(line_ending: String = " ") -> void

Joins all selected lines or lines containing a caret with their next line. Whitespace in between will be removed. If the next line has content, the line_ending will be inserted in between.

func move_lines_down() -> void

Moves all lines down that are selected or have a caret on them.

func move_lines_up() -> void

Moves all lines up that are selected or have a caret on them.

func remove_comment_delimiter(start_key: String) -> void

Removes the comment delimiter with start_key.

func remove_string_delimiter(start_key: String) -> void

Removes the string delimiter with start_key.

func request_code_completion(force: bool = false) -> void

Emits code_completion_requested, if force is true will bypass all checks. Otherwise will check that the caret is in a word or in front of a prefix. Will ignore the request if all current options are of type file path, node path, or signal.

func set_code_completion_selected_index(index: int) -> void

Sets the current selected completion option.

func set_code_hint(code_hint: String) -> void

Sets the code hint text. Pass an empty string to clear.

func set_code_hint_draw_below(draw_below: bool) -> void

If true, the code hint will draw below the main caret. If false, the code hint will draw above the main caret. See set_code_hint().

func set_code_region_tags(start: String = "region", end: String = "endregion") -> void

Sets the code region start and end tags (without comment delimiter).

func set_line_as_bookmarked(line: int, bookmarked: bool) -> void

Sets the given line as bookmarked. If true and gutters_draw_bookmarks is true, draws the bookmark icon in the gutter for this line. See get_bookmarked_lines() and is_line_bookmarked().

func set_line_as_breakpoint(line: int, breakpointed: bool) -> void

Sets the given line as a breakpoint. If true and gutters_draw_breakpoints_gutter is true, draws the breakpoint icon in the gutter for this line. See get_breakpointed_lines() and is_line_breakpointed().

func set_line_as_executing(line: int, executing: bool) -> void

Sets the given line as executing. If true and gutters_draw_executing_lines is true, draws the executing_line icon in the gutter for this line. See get_executing_lines() and is_line_executing().

func set_symbol_lookup_word_as_valid(valid: bool) -> void

Sets the symbol emitted by symbol_validate as a valid lookup.

func toggle_foldable_line(line: int) -> void

Toggle the folding of the code block at the given line.

func toggle_foldable_lines_at_carets() -> void

Toggle the folding of the code block on all lines with a caret on them.

func unfold_all_lines() -> void

Unfolds all lines that are folded.

func unfold_line(line: int) -> void

Unfolds the given line if it is folded or if it is hidden under a folded line.

func unindent_lines() -> void

Unindents all lines that are selected or have a caret on them. Uses spaces or a tab depending on indent_use_spaces. Equivalent to the ProjectSettings.input/ui_text_dedent action. See indent_lines().

func update_code_completion_options(force: bool) -> void

Submits all completion options added with add_code_completion_option(). Will try to force the autocomplete menu to popup, if force is true.

Note: This will replace all current candidates.

Inherited from TextEdit (161)
func _backspace(caret_index: int) -> void
func _copy(caret_index: int) -> void
func _cut(caret_index: int) -> void
func _handle_unicode_input(unicode_char: int, caret_index: int) -> void
func _paste(caret_index: int) -> void
func _paste_primary_clipboard(caret_index: int) -> void
func add_caret(line: int, column: int) -> int
func add_caret_at_carets(below: bool) -> void
func add_gutter(at: int = -1) -> void
func adjust_carets_after_edit(caret: int, from_line: int, from_col: int, to_line: int, to_col: int) -> void
func adjust_viewport_to_caret(caret_index: int = 0) -> void
func apply_ime() -> void
func backspace(caret_index: int = -1) -> void
func begin_multicaret_edit() -> void
func cancel_ime() -> void
func center_viewport_to_caret(caret_index: int = 0) -> void
func clear() -> void
func clear_undo_history() -> void
func collapse_carets(from_line: int, from_column: int, to_line: int, to_column: int, inclusive: bool = false) -> void
func copy(caret_index: int = -1) -> void
func cut(caret_index: int = -1) -> void
func delete_selection(caret_index: int = -1) -> void
func deselect(caret_index: int = -1) -> void
func end_action() -> void
func end_complex_operation() -> void
func end_multicaret_edit() -> void
func get_caret_column(caret_index: int = 0) -> int
func get_caret_draw_pos(caret_index: int = 0) -> Vector2
func get_caret_line(caret_index: int = 0) -> int
func get_caret_wrap_index(caret_index: int = 0) -> int
func get_gutter_name(gutter: int) -> String
func get_gutter_width(gutter: int) -> int
func get_indent_level(line: int) -> int
func get_line(line: int) -> String
func get_line_column_at_pos(position: Vector2i, clamp_line: bool = true, clamp_column: bool = true) -> Vector2i
func get_line_gutter_icon(line: int, gutter: int) -> Texture2D
func get_line_gutter_item_color(line: int, gutter: int) -> Color
func get_line_gutter_metadata(line: int, gutter: int) -> Variant
func get_line_gutter_text(line: int, gutter: int) -> String
func get_line_ranges_from_carets(only_selections: bool = false, merge_adjacent: bool = true) -> Vector2i[]
func get_line_width(line: int, wrap_index: int = -1) -> int
func get_line_wrap_count(line: int) -> int
func get_line_wrap_index_at_column(line: int, column: int) -> int
func get_next_visible_line_index_offset_from(line: int, wrap_index: int, visible_amount: int) -> Vector2i
func get_next_visible_line_offset_from(line: int, visible_amount: int) -> int
func get_pos_at_line_column(line: int, column: int) -> Vector2i
func get_rect_at_line_column(line: int, column: int) -> Rect2i
func get_scroll_pos_for_line(line: int, wrap_index: int = 0) -> float
func get_selected_text(caret_index: int = -1) -> String
func get_selection_at_line_column(line: int, column: int, include_edges: bool = true, only_selections: bool = true) -> int
func get_selection_column(caret_index: int = 0) -> int
func get_selection_from_column(caret_index: int = 0) -> int
func get_selection_from_line(caret_index: int = 0) -> int
func get_selection_line(caret_index: int = 0) -> int
func get_selection_origin_column(caret_index: int = 0) -> int
func get_selection_origin_line(caret_index: int = 0) -> int
func get_selection_to_column(caret_index: int = 0) -> int
func get_selection_to_line(caret_index: int = 0) -> int
func get_sorted_carets(include_ignored_carets: bool = false) -> PackedInt32Array
func get_tab_size() -> int
func get_version() -> int
func get_visible_line_count_in_range(from_line: int, to_line: int) -> int
func get_word_at_pos(position: Vector2) -> String
func get_word_under_caret(caret_index: int = -1) -> String
func has_ime_text() -> bool
func has_redo() -> bool
func has_selection(caret_index: int = -1) -> bool
func has_undo() -> bool
func insert_line_at(line: int, text: String) -> void
func insert_text(text: String, line: int, column: int, before_selection_begin: bool = true, before_selection_end: bool = false) -> void
func insert_text_at_caret(text: String, caret_index: int = -1) -> void
func is_caret_after_selection_origin(caret_index: int = 0) -> bool
func is_caret_visible(caret_index: int = 0) -> bool
func is_gutter_clickable(gutter: int) -> bool
func is_gutter_drawn(gutter: int) -> bool
func is_line_gutter_clickable(line: int, gutter: int) -> bool
func is_line_wrapped(line: int) -> bool
func is_mouse_over_selection(edges: bool, caret_index: int = -1) -> bool
func menu_option(option: int) -> void
func merge_gutters(from_line: int, to_line: int) -> void
func multicaret_edit_ignore_caret(caret_index: int) -> bool
func paste(caret_index: int = -1) -> void
func paste_primary_clipboard(caret_index: int = -1) -> void
func redo() -> void
func remove_caret(caret: int) -> void
func remove_gutter(gutter: int) -> void
func remove_line_at(line: int, move_carets_down: bool = true) -> void
func remove_text(from_line: int, from_column: int, to_line: int, to_column: int) -> void
func select(origin_line: int, origin_column: int, caret_line: int, caret_column: int, caret_index: int = 0) -> void
func select_all() -> void
func select_word_under_caret(caret_index: int = -1) -> void
func set_caret_column(column: int, adjust_viewport: bool = true, caret_index: int = 0) -> void
func set_caret_line(line: int, adjust_viewport: bool = true, can_be_hidden: bool = true, wrap_index: int = 0, caret_index: int = 0) -> void
func set_gutter_clickable(gutter: int, clickable: bool) -> void
func set_gutter_custom_draw(column: int, draw_callback: Callable) -> void
func set_gutter_draw(gutter: int, draw: bool) -> void
func set_gutter_name(gutter: int, name: String) -> void
func set_gutter_overwritable(gutter: int, overwritable: bool) -> void
func set_gutter_type(gutter: int, type: TextEdit.GutterType) -> void
func set_gutter_width(gutter: int, width: int) -> void
func set_line(line: int, new_text: String) -> void
func set_line_as_center_visible(line: int, wrap_index: int = 0) -> void
func set_line_as_first_visible(line: int, wrap_index: int = 0) -> void
func set_line_as_last_visible(line: int, wrap_index: int = 0) -> void
func set_line_background_color(line: int, color: Color) -> void
func set_line_gutter_clickable(line: int, gutter: int, clickable: bool) -> void
func set_line_gutter_icon(line: int, gutter: int, icon: Texture2D) -> void
func set_line_gutter_item_color(line: int, gutter: int, color: Color) -> void
func set_line_gutter_metadata(line: int, gutter: int, metadata: Variant) -> void
func set_line_gutter_text(line: int, gutter: int, text: String) -> void
func set_overtype_mode_enabled(enabled: bool) -> void
func set_search_flags(flags: int) -> void
func set_search_text(search_text: String) -> void
func set_selection_origin_column(column: int, caret_index: int = 0) -> void
func set_selection_origin_line(line: int, can_be_hidden: bool = true, wrap_index: int = -1, caret_index: int = 0) -> void
func set_tab_size(size: int) -> void
func set_tooltip_request_func(callback: Callable) -> void
func start_action(action: TextEdit.EditAction) -> void
func swap_lines(from_line: int, to_line: int) -> void
func tag_saved_version() -> void
func undo() -> void
Inherited from Control (100)
func _can_drop_data(at_position: Vector2, data: Variant) -> bool
func _drop_data(at_position: Vector2, data: Variant) -> void
func _get_cursor_shape(at_position: Vector2) -> int
func _get_drag_data(at_position: Vector2) -> Variant
func _get_tooltip(at_position: Vector2) -> String
func _gui_input(event: InputEvent) -> void
func _has_point(point: Vector2) -> bool
func _structured_text_parser(args: Array, text: String) -> Vector3i[]
func accept_event() -> void
func accessibility_drag() -> void
func accessibility_drop() -> void
func add_theme_color_override(name: StringName, color: Color) -> void
func add_theme_constant_override(name: StringName, constant: int) -> void
func add_theme_font_override(name: StringName, font: Font) -> void
func add_theme_font_size_override(name: StringName, font_size: int) -> void
func add_theme_icon_override(name: StringName, texture: Texture2D) -> void
func add_theme_stylebox_override(name: StringName, stylebox: StyleBox) -> void
func force_drag(data: Variant, preview: Control) -> void
func get_anchor(side: Side) -> float
func get_begin() -> Vector2
func get_cursor_shape(at_position: Vector2 = Vector2(0, 0)) -> Control.CursorShape
func get_end() -> Vector2
func get_focus_neighbor(side: Side) -> NodePath
func get_offset(offset: Side) -> float
func get_rect() -> Rect2
func get_theme_color(name: StringName, theme_type: StringName = &"") -> Color
func get_theme_constant(name: StringName, theme_type: StringName = &"") -> int
func get_theme_font(name: StringName, theme_type: StringName = &"") -> Font
func get_theme_font_size(name: StringName, theme_type: StringName = &"") -> int
func get_theme_icon(name: StringName, theme_type: StringName = &"") -> Texture2D
func get_theme_stylebox(name: StringName, theme_type: StringName = &"") -> StyleBox
func get_tooltip(at_position: Vector2 = Vector2(0, 0)) -> String
func grab_click_focus() -> void
func grab_focus(hide_focus: bool = false) -> void
func has_focus(ignore_hidden_focus: bool = false) -> bool
func has_theme_color(name: StringName, theme_type: StringName = &"") -> bool
func has_theme_constant(name: StringName, theme_type: StringName = &"") -> bool
func has_theme_font(name: StringName, theme_type: StringName = &"") -> bool
func has_theme_font_size(name: StringName, theme_type: StringName = &"") -> bool
func has_theme_icon(name: StringName, theme_type: StringName = &"") -> bool
func has_theme_stylebox(name: StringName, theme_type: StringName = &"") -> bool
func release_focus() -> void
func reset_size() -> void
func set_anchor(side: Side, anchor: float, keep_offset: bool = false, push_opposite_anchor: bool = true) -> void
func set_anchor_and_offset(side: Side, anchor: float, offset: float, push_opposite_anchor: bool = false) -> void
func set_anchors_and_offsets_preset(preset: Control.LayoutPreset, resize_mode: Control.LayoutPresetMode = 0, margin: int = 0) -> void
func set_anchors_preset(preset: Control.LayoutPreset, keep_offsets: bool = false) -> void
func set_begin(position: Vector2) -> void
func set_drag_forwarding(drag_func: Callable, can_drop_func: Callable, drop_func: Callable) -> void
func set_drag_preview(control: Control) -> void
func set_end(position: Vector2) -> void
func set_focus_neighbor(side: Side, neighbor: NodePath) -> void
func set_global_position(position: Vector2, keep_offsets: bool = false) -> void
func set_offset(side: Side, offset: float) -> void
func set_offsets_preset(preset: Control.LayoutPreset, resize_mode: Control.LayoutPresetMode = 0, margin: int = 0) -> void
func set_position(position: Vector2, keep_offsets: bool = false) -> void
func set_size(size: Vector2, keep_offsets: bool = false) -> void
func update_maximum_size() -> void
func update_minimum_size() -> void
func warp_mouse(position: Vector2) -> void
Inherited from CanvasItem (62)
func _draw() -> void
func draw_animation_slice(animation_length: float, slice_begin: float, slice_end: float, offset: float = 0.0) -> void
func draw_arc(center: Vector2, radius: float, start_angle: float, end_angle: float, point_count: int, color: Color, width: float = -1.0, antialiased: bool = false) -> void
func draw_char(font: Font, pos: Vector2, char: String, font_size: int = 16, modulate: Color = Color(1, 1, 1, 1), oversampling: float = 0.0) -> void
func draw_char_outline(font: Font, pos: Vector2, char: String, font_size: int = 16, size: int = -1, modulate: Color = Color(1, 1, 1, 1), oversampling: float = 0.0) -> void
func draw_circle(position: Vector2, radius: float, color: Color, filled: bool = true, width: float = -1.0, antialiased: bool = false) -> void
func draw_colored_polygon(points: PackedVector2Array, color: Color, uvs: PackedVector2Array = PackedVector2Array(), texture: Texture2D = null) -> void
func draw_dashed_line(from: Vector2, to: Vector2, color: Color, width: float = -1.0, dash: float = 2.0, aligned: bool = true, antialiased: bool = false) -> void
func draw_ellipse(position: Vector2, major: float, minor: float, color: Color, filled: bool = true, width: float = -1.0, antialiased: bool = false) -> void
func draw_ellipse_arc(center: Vector2, major: float, minor: float, start_angle: float, end_angle: float, point_count: int, color: Color, width: float = -1.0, antialiased: bool = false) -> void
func draw_end_animation() -> void
func draw_lcd_texture_rect_region(texture: Texture2D, rect: Rect2, src_rect: Rect2, modulate: Color = Color(1, 1, 1, 1)) -> void
func draw_line(from: Vector2, to: Vector2, color: Color, width: float = -1.0, antialiased: bool = false) -> void
func draw_mesh(mesh: Mesh, texture: Texture2D, transform: Transform2D = Transform2D(1, 0, 0, 1, 0, 0), modulate: Color = Color(1, 1, 1, 1)) -> void
func draw_msdf_texture_rect_region(texture: Texture2D, rect: Rect2, src_rect: Rect2, modulate: Color = Color(1, 1, 1, 1), outline: float = 0.0, pixel_range: float = 4.0, scale: float = 1.0) -> void
func draw_multiline(points: PackedVector2Array, color: Color, width: float = -1.0, antialiased: bool = false) -> void
func draw_multiline_colors(points: PackedVector2Array, colors: PackedColorArray, width: float = -1.0, antialiased: bool = false) -> void
func draw_multiline_string(font: Font, pos: Vector2, text: String, alignment: HorizontalAlignment = 0, width: float = -1, font_size: int = 16, max_lines: int = -1, modulate: Color = Color(1, 1, 1, 1), brk_flags: TextServer.LineBreakFlag = 3, justification_flags: TextServer.JustificationFlag = 3, direction: TextServer.Direction = 0, orientation: TextServer.Orientation = 0, oversampling: float = 0.0) -> void
func draw_multiline_string_outline(font: Font, pos: Vector2, text: String, alignment: HorizontalAlignment = 0, width: float = -1, font_size: int = 16, max_lines: int = -1, size: int = 1, modulate: Color = Color(1, 1, 1, 1), brk_flags: TextServer.LineBreakFlag = 3, justification_flags: TextServer.JustificationFlag = 3, direction: TextServer.Direction = 0, orientation: TextServer.Orientation = 0, oversampling: float = 0.0) -> void
func draw_multimesh(multimesh: MultiMesh, texture: Texture2D) -> void
func draw_polygon(points: PackedVector2Array, colors: PackedColorArray, uvs: PackedVector2Array = PackedVector2Array(), texture: Texture2D = null) -> void
func draw_polyline(points: PackedVector2Array, color: Color, width: float = -1.0, antialiased: bool = false) -> void
func draw_polyline_colors(points: PackedVector2Array, colors: PackedColorArray, width: float = -1.0, antialiased: bool = false) -> void
func draw_primitive(points: PackedVector2Array, colors: PackedColorArray, uvs: PackedVector2Array, texture: Texture2D = null) -> void
func draw_rect(rect: Rect2, color: Color, filled: bool = true, width: float = -1.0, antialiased: bool = false) -> void
func draw_set_transform(position: Vector2, rotation: float = 0.0, scale: Vector2 = Vector2(1, 1)) -> void
func draw_string(font: Font, pos: Vector2, text: String, alignment: HorizontalAlignment = 0, width: float = -1, font_size: int = 16, modulate: Color = Color(1, 1, 1, 1), justification_flags: TextServer.JustificationFlag = 3, direction: TextServer.Direction = 0, orientation: TextServer.Orientation = 0, oversampling: float = 0.0) -> void
func draw_string_outline(font: Font, pos: Vector2, text: String, alignment: HorizontalAlignment = 0, width: float = -1, font_size: int = 16, size: int = 1, modulate: Color = Color(1, 1, 1, 1), justification_flags: TextServer.JustificationFlag = 3, direction: TextServer.Direction = 0, orientation: TextServer.Orientation = 0, oversampling: float = 0.0) -> void
func draw_style_box(style_box: StyleBox, rect: Rect2) -> void
func draw_texture(texture: Texture2D, position: Vector2, modulate: Color = Color(1, 1, 1, 1)) -> void
func draw_texture_rect(texture: Texture2D, rect: Rect2, tile: bool, modulate: Color = Color(1, 1, 1, 1), transpose: bool = false) -> void
func draw_texture_rect_region(texture: Texture2D, rect: Rect2, src_rect: Rect2, modulate: Color = Color(1, 1, 1, 1), transpose: bool = false, clip_uv: bool = true) -> void
func force_update_transform() -> void
func get_canvas() -> RID
func hide() -> void
func make_canvas_position_local(viewport_point: Vector2) -> Vector2
func move_to_front() -> void
func queue_redraw() -> void
func set_notify_local_transform(enable: bool) -> void
func set_notify_transform(enable: bool) -> void
func set_visibility_layer_bit(layer: int, enabled: bool) -> void
func show() -> void
Inherited from Node (106)
func _enter_tree() -> void
func _exit_tree() -> void
func _input(event: InputEvent) -> void
func _physics_process(delta: float) -> void
func _process(delta: float) -> void
func _ready() -> void
func _shortcut_input(event: InputEvent) -> void
func _unhandled_input(event: InputEvent) -> void
func _unhandled_key_input(event: InputEvent) -> void
func add_child(node: Node, force_readable_name: bool = false, internal: Node.InternalMode = 0) -> void
func add_sibling(sibling: Node, force_readable_name: bool = false) -> void
func add_to_group(group: StringName, persistent: bool = false) -> void
func atr(message: String, context: StringName = "") -> String
func atr_n(message: String, plural_message: StringName, n: int, context: StringName = "") -> String
func can_process() -> bool
func duplicate(flags: int = 15) -> Node
func find_child(pattern: String, recursive: bool = true, owned: bool = true) -> Node
func find_children(pattern: String, type: String = "", recursive: bool = true, owned: bool = true) -> Node[]
func find_parent(pattern: String) -> Node
func get_child(idx: int, include_internal: bool = false) -> Node
func get_child_count(include_internal: bool = false) -> int
func get_children(include_internal: bool = false) -> Node[]
func get_groups() -> StringName[]
func get_index(include_internal: bool = false) -> int
func get_node(path: NodePath) -> Node
func get_orphan_node_ids() -> int[]
func get_parent() -> Node
func get_path() -> NodePath
func get_path_to(node: Node, use_unique_path: bool = false) -> NodePath
func get_window() -> Window
func has_node(path: NodePath) -> bool
func is_ancestor_of(node: Node) -> bool
func is_greater_than(node: Node) -> bool
func is_in_group(group: StringName) -> bool
func move_child(child_node: Node, to_index: int) -> void
func notify_deferred_thread_group(what: int) -> void
func notify_thread_safe(what: int) -> void
func print_orphan_nodes() -> void
func print_tree() -> void
func print_tree_pretty() -> void
func propagate_call(method: StringName, args: Array = [], parent_first: bool = false) -> void
func propagate_notification(what: int) -> void
func queue_free() -> void
func remove_child(node: Node) -> void
func remove_from_group(group: StringName) -> void
func reparent(new_parent: Node, keep_global_transform: bool = true) -> void
func replace_by(node: Node, keep_groups: bool = false) -> void
func request_ready() -> void
func rpc(method: StringName) -> Error
func rpc_config(method: StringName, config: Variant) -> void
func rpc_id(peer_id: int, method: StringName) -> Error
func set_deferred_thread_group(property: StringName, value: Variant) -> void
func set_display_folded(fold: bool) -> void
func set_editable_instance(node: Node, is_editable: bool) -> void
func set_multiplayer_authority(id: int, recursive: bool = true) -> void
func set_physics_process(enable: bool) -> void
func set_physics_process_internal(enable: bool) -> void
func set_process(enable: bool) -> void
func set_process_input(enable: bool) -> void
func set_process_internal(enable: bool) -> void
func set_process_shortcut_input(enable: bool) -> void
func set_process_unhandled_input(enable: bool) -> void
func set_scene_instance_load_placeholder(load_placeholder: bool) -> void
func set_thread_safe(property: StringName, value: Variant) -> void
Inherited from Object (62)
func _get(property: StringName) -> Variant
func _get_property_list() -> Dictionary[]
func _init() -> void
func _iter_get(iter: Variant) -> Variant
func _iter_init(iter: Array) -> bool
func _iter_next(iter: Array) -> bool
func _notification(what: int) -> void
func _set(property: StringName, value: Variant) -> bool
func _to_string() -> String
func _validate_property(property: Dictionary) -> void
func add_user_signal(signal: String, arguments: Array = []) -> void
func call(method: StringName) -> Variant
func callv(method: StringName, arg_array: Array) -> Variant
func cancel_free() -> void
func connect(signal: StringName, callable: Callable, flags: int = 0) -> Error
func disconnect(signal: StringName, callable: Callable) -> void
func emit_signal(signal: StringName) -> Error
func free() -> void
func get(property: StringName) -> Variant
func get_class() -> String
func get_incoming_connections() -> Dictionary[]
func get_indexed(property_path: NodePath) -> Variant
func get_meta(name: StringName, default: Variant = null) -> Variant
func get_meta_list() -> StringName[]
func get_method_list() -> Dictionary[]
func get_property_list() -> Dictionary[]
func get_signal_connection_list(signal: StringName) -> Dictionary[]
func get_signal_list() -> Dictionary[]
func has_meta(name: StringName) -> bool
func has_method(method: StringName) -> bool
func has_signal(signal: StringName) -> bool
func is_class(class: StringName) -> bool
func is_connected(signal: StringName, callable: Callable) -> bool
func notification(what: int, reversed: bool = false) -> void
func remove_meta(name: StringName) -> void
func remove_user_signal(signal: StringName) -> void
func set(property: StringName, value: Variant) -> void
func set_block_signals(enable: bool) -> void
func set_deferred(property: StringName, value: Variant) -> void
func set_indexed(property_path: NodePath, value: Variant) -> void
func set_message_translation(enable: bool) -> void
func set_meta(name: StringName, value: Variant) -> void
func set_script(script: Variant) -> void
func set_translation_domain(domain: StringName) -> void
func to_string() -> String
func tr(message: StringName, context: StringName = &"") -> String
func tr_n(message: StringName, plural_message: StringName, n: int, context: StringName = &"") -> String

Signals

signal breakpoint_toggled(line: int)

Emitted when a breakpoint is added or removed from a line. If the line is removed via backspace, a signal is emitted at the old line.

signal code_completion_requested()

Emitted when the user requests code completion. This signal will not be sent if _request_code_completion() is overridden or code_completion_enabled is false.

signal symbol_hovered(symbol: String, line: int, column: int)

Emitted when the user hovers over a symbol. Unlike Control.mouse_entered, this signal is not emitted immediately, but when the cursor is over the symbol for ProjectSettings.gui/timers/tooltip_delay_sec seconds.

Note: symbol_tooltip_on_hover must be true for this signal to be emitted.

signal symbol_lookup(symbol: String, line: int, column: int)

Emitted when the user has clicked on a valid symbol.

signal symbol_validate(symbol: String)

Emitted when the user hovers over a symbol. The symbol should be validated and responded to, by calling set_symbol_lookup_word_as_valid().

Note: symbol_lookup_on_click must be true for this signal to be emitted.

Inherited from TextEdit (7)
signal caret_changed()
signal gutter_added()
signal gutter_clicked(line: int, gutter: int)
signal lines_edited_from(from_line: int, to_line: int)
signal text_changed()
signal text_set()
Inherited from Control (10)
signal focus_entered()
signal focus_exited()
signal gui_input(event: InputEvent)
signal mouse_entered()
signal mouse_exited()
signal resized()
signal theme_changed()
Inherited from CanvasItem (4)
signal draw()
signal hidden()
Inherited from Node (11)
signal child_entered_tree(node: Node)
signal child_exiting_tree(node: Node)
signal ready()
signal renamed()
signal replacing_by(node: Node)
signal tree_entered()
signal tree_exited()
signal tree_exiting()
Inherited from Object (2)

Enums & Constants

enum CodeCompletionKind
KIND_CLASS = 0

Marks the option as a class.

KIND_FUNCTION = 1

Marks the option as a function.

KIND_SIGNAL = 2

Marks the option as a Godot signal.

KIND_VARIABLE = 3

Marks the option as a variable.

KIND_MEMBER = 4

Marks the option as a member.

KIND_ENUM = 5

Marks the option as an enum entry.

KIND_CONSTANT = 6

Marks the option as a constant.

KIND_NODE_PATH = 7

Marks the option as a Godot node path.

KIND_FILE_PATH = 8

Marks the option as a file path.

KIND_PLAIN_TEXT = 9

Marks the option as unclassified or plain text.

KIND_KEYWORD = 10

Marks the option as a keyword.

enum CodeCompletionLocation
LOCATION_LOCAL = 0

The option is local to the location of the code completion query - e.g. a local variable. Subsequent value of location represent options from the outer class, the exact value represent how far they are (in terms of inner classes).

LOCATION_PARENT_MASK = 256

The option is from the containing class or a parent class, relative to the location of the code completion query. Perform a bitwise OR with the class depth (e.g. 0 for the local class, 1 for the parent, 2 for the grandparent, etc.) to store the depth of an option in the class or a parent class.

LOCATION_OTHER_USER_CODE = 512

The option is from user code which is not local and not in a derived class (e.g. Autoload Singletons).

LOCATION_OTHER = 1024

The option is from other engine code, not covered by the other enum constants - e.g. built-in classes.