Multiline text control intended for editing code.
CodeEdit is a specialised [TextEdit] designed for editing plain text code files. It contains a bunch of features commonly found in code editors such as line numbers, line folding, code completion, indent management and string / comment management.
[b]Note:[/b] By default [CodeEdit] always use left-to-right text direction to correctly display source code.
Override this method to define how the selected entry should be inserted. If [code]replace[/code] is true, any existing text should be replaced.
Override this method to define what items in [code]candidates[/code] should be displayed.
Both [code]candidates[/code] and the return is a [Array] of [Dictionary], see [method get_code_completion_option] for [Dictionary] content.
Override this method to define what happens when the user requests code completion. If [code]force[/code] is true, any checks should be bypassed.
Adds a brace pair.
Both the start and end keys must be symbols. Only the start key has to be unique.
Submits an item to the queue of potential candidates for the autocomplete menu. Call [method update_code_completion_options] to update the list.
[b]Note:[/b] This list will replace all current candidates.
Adds a comment delimiter.
Both the start and end keys must be symbols. Only the start key has to be unique.
Line only denotes if the region should continue until the end of the line or carry over on to the next line. If the end key is blank this is automatically set to [code]true[/code].
Adds a string delimiter.
Both the start and end keys must be symbols. Only the start key has to be unique.
Line only denotes if the region should continue until the end of the line or carry over on to the next line. If the end key is blank this is automatically set to [code]true[/code].
Returns if the given line is foldable, that is, it has indented lines right below it or a comment / string block.
Cancels the autocomplete menu.
Clears all bookmarked lines.
Clears all breakpointed lines.
Removes all comment delimiters.
Clears all executed lines.
Removes all string delimiters.
Inserts the selected entry into the text. If [code]replace[/code] is true, any existing text is replaced rather then merged.
Perform an indent as if the user activated the "ui_text_indent" action.
Perform an unindent as if the user activated the "ui_text_unindent" action.
Folds all lines that are possible to be folded (see [method can_fold_line]).
Folds the given line, if possible (see [method can_fold_line]).
Gets the matching auto brace close key for [code]open_key[/code].
Gets all bookmarked lines.
Gets all breakpointed lines.
Gets the completion option at [code]index[/code]. The return [Dictionary] has the following key-values:
[code]kind[/code]: [enum CodeCompletionKind]
[code]display_text[/code]: Text that is shown on the autocomplete menu.
[code]insert_text[/code]: Text that is to be inserted when this item is selected.
[code]font_color[/code]: Color of the text on the autocomplete menu.
[code]icon[/code]: Icon to draw on the autocomplete menu.
[code]default_value[/code]: Value of the symbol.
Gets all completion options, see [method get_code_completion_option] for return content.
Gets the index of the current selected completion option.
Gets the end key for a string or comment region index.
If [code]line[/code] [code]column[/code] 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 [code]-1[/code].
Gets the start key for a string or comment region index.
If [code]line[/code] [code]column[/code] 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 [code]-1[/code].
Gets all executing lines.
Returns all lines that are current folded.
Returns the full text with char [code]0xFFFF[/code] at the caret location.
Returns the full text with char [code]0xFFFF[/code] at the cursor location.
Returns [code]true[/code] if close key [code]close_key[/code] exists.
Returns [code]true[/code] if open key [code]open_key[/code] exists.
Returns [code]true[/code] if comment [code]start_key[/code] exists.
Returns [code]true[/code] if string [code]start_key[/code] exists.
Indents selected lines, or in the case of no selection the caret line by one.
Returns delimiter index if [code]line[/code] [code]column[/code] is in a comment. If [code]column[/code] is not provided, will return delimiter index if the entire [code]line[/code] is a comment. Otherwise [code]-1[/code].
Returns the delimiter index if [code]line[/code] [code]column[/code] is in a string. If [code]column[/code] is not provided, will return the delimiter index if the entire [code]line[/code] is a string. Otherwise [code]-1[/code].
Returns whether the line at the specified index is bookmarked or not.
Returns whether the line at the specified index is breakpointed or not.
Returns whether the line at the specified index is marked as executing or not.
Returns whether the line at the specified index is folded or not.
Removes the comment delimiter with [code]start_key[/code].
Removes the string delimiter with [code]start_key[/code].
Emits [signal code_completion_requested], if [code]force[/code] 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.
Sets the current selected completion option.
Sets the code hint text. Pass an empty string to clear.
Sets if the code hint should draw below the text.
Sets the line as bookmarked.
Sets the line as breakpointed.
Sets the line as executing.
Sets the symbol emitted by [signal symbol_validate] as a valid lookup.
Toggle the folding of the code block at the given line.
Unfolds all lines, folded or not.
Unfolds all lines that were previously folded.
Unindents selected lines, or in the case of no selection the caret line by one.
Submits all completion options added with [method add_code_completion_option]. Will try to force the autoccomplete menu to popup, if [code]force[/code] is [code]true[/code].
[b]Note:[/b] This will replace all current candidates.
Sets whether brace pairs should be autocompleted.
Highlight mismatching brace pairs.
Sets the brace pairs to be autocompleted.
Sets whether code completion is allowed.
Sets prefixes that will trigger code completion.
Sets the comment delimiters. All existing comment delimiters will be removed.
Sets the string delimiters. All existing string delimiters will be removed.
Sets if bookmarked should be drawn in the gutter. This gutter is shared with breakpoints and executing lines.
Sets if breakpoints should be drawn in the gutter. This gutter is shared with bookmarks and executing lines.
Sets if executing lines should be marked in the gutter. This gutter is shared with breakpoints and bookmarks lines.
Sets if foldable lines icons should be drawn in the gutter.
Sets if line numbers should be drawn in the gutter.
Sets if line numbers drawn in the gutter are zero padded.
Sets whether automatic indent are enabled, this will add an extra indent if a prefix or brace is found.
Prefixes to trigger an automatic indent.
Size of tabs, if [code]indent_use_spaces[/code] is enabled the amount of spaces to use.
Use spaces instead of tabs for indentation.
Sets whether line folding is allowed.
Draws vertical lines at the provided columns. The first entry is considered a main hard guideline and is draw more prominently
Set when a validated word from [signal symbol_validate] is clicked, the [signal symbol_lookup] should be emitted.
Emitted when a breakpoint is added or removed from a line. If the line is moved via backspace a removed is emitted at the old line.
Emitted when the user requests code completion.
Emitted when the user has clicked on a valid symbol.
Emitted when the user hovers over a symbol. The symbol should be validated and responded to, by calling [method set_symbol_lookup_word_as_valid].
Marks the option as a class.
Marks the option as a function.
Marks the option as a Godot signal.
Marks the option as a variable.
Marks the option as a member.
Marks the option as a enum entry.
Marks the option as a constant.
Marks the option as a Godot node path.
Marks the option as a file path.
Marks the option as unclassified or plain text.
Sets the background [Color].
[Color] of the bookmark icon for bookmarked lines.
[Color] of the text to highlight mismatched braces.
[Color] of the breakpoint icon for bookmarked lines.
[Color] of the text behind the caret when block caret is enabled.
[Color] of the caret.
[Color] for all icons related to line folding.
Sets the background [Color] for the code completion popup.
Background highlight [Color] for matching text in code completion options.
Font [Color] for the code completion popup.
[Color] of the scrollbar in the code completion popup.
[Color] of the scrollbar in the code completion popup when hovered.
Background highlight [Color] for the current selected option item in the code completion popup.
Background [Color] of the line containing the caret.
[Color] of the executing icon for executing lines.
Sets the font [Color].
The tint of text outline of the [CodeEdit].
Font color for [member TextEdit.placeholder_text].
Sets the font [Color] when [member TextEdit.editable] is disabled.
Sets the [Color] of the selected text. [member TextEdit.override_selected_font_color] has to be enabled.
[Color] of the main line length guideline, secondary guidelines will have 50% alpha applied.
Sets the [Color] of line numbers.
[Color] of the border around text that matches the search query.
[Color] behind the text that matches the search query.
Sets the highlight [Color] of text selections.
Sets the highlight [Color] of multiple occurrences. [member TextEdit.highlight_all_occurrences] has to be enabled.
Max number of options to display in the code completion popup at any one time.
Max width of options in the code completion popup. Options longer then this will be cut off.
Width of the scrollbar in the code completion popup.
Sets the spacing between the lines.
The size of the text outline.
Sets the default [Font].
Sets default font size.
Sets a custom [Texture2D] to draw in the bookmark gutter for bookmarked lines.
Sets a custom [Texture2D] to draw in the breakpoint gutter for breakpointed lines.
Sets a custom [Texture2D] to draw in the line folding gutter when a line can be folded.
Icon to draw in the executing gutter for executing lines.
Sets a custom [Texture2D] to draw in the line folding gutter when a line is folded and can be unfolded.
Sets a custom [Texture2D] to draw at the end of a folded line.
Sets a custom [Texture2D] for space text characters.
Sets a custom [Texture2D] for tab text characters.
[StyleBox] for the code completion popup.
Sets the [StyleBox] when in focus. The [code]focus[/code] [StyleBox] is displayed [i]over[/i] the base [StyleBox], so a partially transparent [StyleBox] should be used to ensure the base [StyleBox] remains visible. A [StyleBox] that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a [StyleBoxEmpty] resource. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons.
Sets the [StyleBox].
Sets the [StyleBox] when [member TextEdit.editable] is disabled.