CodeEdit

package
v0.0.0-...-5e8c587 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2025 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsCodeEdit() Instance
}

type CodeCompletionKind

type CodeCompletionKind int //gd:CodeEdit.CodeCompletionKind
const (
	// Marks the option as a class.
	KindClass CodeCompletionKind = 0
	// Marks the option as a function.
	KindFunction CodeCompletionKind = 1
	// Marks the option as a Godot signal.
	KindSignal CodeCompletionKind = 2
	// Marks the option as a variable.
	KindVariable CodeCompletionKind = 3
	// Marks the option as a member.
	KindMember CodeCompletionKind = 4
	// Marks the option as an enum entry.
	KindEnum CodeCompletionKind = 5
	// Marks the option as a constant.
	KindConstant CodeCompletionKind = 6
	// Marks the option as a Godot node path.
	KindNodePath CodeCompletionKind = 7
	// Marks the option as a file path.
	KindFilePath CodeCompletionKind = 8
	// Marks the option as unclassified or plain text.
	KindPlainText CodeCompletionKind = 9
)

type CodeCompletionLocation

type CodeCompletionLocation int //gd:CodeEdit.CodeCompletionLocation
const (
	// 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).
	LocationLocal CodeCompletionLocation = 0
	// 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.
	LocationParentMask CodeCompletionLocation = 256
	// The option is from user code which is not local and not in a derived class (e.g. Autoload Singletons).
	LocationOtherUserCode CodeCompletionLocation = 512
	// The option is from other engine code, not covered by the other enum constants - e.g. built-in classes.
	LocationOther CodeCompletionLocation = 1024
)

type CompletionInfo

type CompletionInfo struct {
	Kind        CodeCompletionKind `gd:"kind"`
	DisplayText string             `gd:"display_text"`
	InsertText  string             `gd:"insert_text"`
	FontColor   struct {
		R float32
		G float32
		B float32
		A float32
	} `gd:"font_color"`
	Icon         string `gd:"icon"`
	DefaultValue string `gd:"default_value"`
}

type Expanded

type Expanded = MoreArgs

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this [Extension]See Interface for methods that can be overridden by T.

func (*Extension[T]) AsCanvasItem

func (self *Extension[T]) AsCanvasItem() CanvasItem.Instance

func (*Extension[T]) AsCodeEdit

func (self *Extension[T]) AsCodeEdit() Instance

func (*Extension[T]) AsControl

func (self *Extension[T]) AsControl() Control.Instance

func (*Extension[T]) AsNode

func (self *Extension[T]) AsNode() Node.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsTextEdit

func (self *Extension[T]) AsTextEdit() TextEdit.Instance

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Implementation

type Implementation = implementation

Implementation implements Interface with empty methods.

type Instance

type Instance [1]gdclass.CodeEdit

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AddAutoBraceCompletionPair

func (self Instance) AddAutoBraceCompletionPair(start_key string, end_key string)

Adds a brace pair.

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

func (Instance) AddCodeCompletionOption

func (self Instance) AddCodeCompletionOption(atype CodeCompletionKind, display_text string, insert_text string)

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

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

Note: This list will replace all current candidates.

func (Instance) AddCommentDelimiter

func (self Instance) AddCommentDelimiter(start_key string, end_key string)

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 (Instance) AddStringDelimiter

func (self Instance) AddStringDelimiter(start_key string, end_key string)

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 (Instance) AsCanvasItem

func (self Instance) AsCanvasItem() CanvasItem.Instance

func (Instance) AsCodeEdit

func (self Instance) AsCodeEdit() Instance

func (Instance) AsControl

func (self Instance) AsControl() Control.Instance

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsTextEdit

func (self Instance) AsTextEdit() TextEdit.Instance

func (Instance) AutoBraceCompletionEnabled

func (self Instance) AutoBraceCompletionEnabled() bool

If true, uses AutoBraceCompletionPairs 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.

func (Instance) AutoBraceCompletionHighlightMatching

func (self Instance) AutoBraceCompletionHighlightMatching() bool

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

func (Instance) AutoBraceCompletionPairs

func (self Instance) AutoBraceCompletionPairs() map[any]any

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 AutoBraceCompletionEnabled and AutoBraceCompletionHighlightMatching.

func (Instance) CanFoldLine

func (self Instance) CanFoldLine(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 GetCodeRegionStartTag), if it is the start of a comment or string block, or if the next non-empty line is more indented (see TextEdit.GetIndentLevel).

func (Instance) CancelCodeCompletion

func (self Instance) CancelCodeCompletion()

Cancels the autocomplete menu.

func (Instance) ClearBookmarkedLines

func (self Instance) ClearBookmarkedLines()

Clears all bookmarked lines.

func (Instance) ClearBreakpointedLines

func (self Instance) ClearBreakpointedLines()

Clears all breakpointed lines.

func (Instance) ClearCommentDelimiters

func (self Instance) ClearCommentDelimiters()

Removes all comment delimiters.

func (Instance) ClearExecutingLines

func (self Instance) ClearExecutingLines()

Clears all executed lines.

func (Instance) ClearStringDelimiters

func (self Instance) ClearStringDelimiters()

Removes all string delimiters.

func (Instance) CodeCompletionEnabled

func (self Instance) CodeCompletionEnabled() bool

If true, the ProjectSettings "input/ui_text_completion_query" action requests code completion. To handle it, see RequestCodeCompletion or OnCodeCompletionRequested.

func (Instance) CodeCompletionPrefixes

func (self Instance) CodeCompletionPrefixes() []string

Sets prefixes that will trigger code completion.

func (Instance) ConfirmCodeCompletion

func (self Instance) ConfirmCodeCompletion()

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

func (Instance) ConvertIndent

func (self Instance) ConvertIndent()

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

Values of -1 convert the entire text.

func (Instance) CreateCodeRegion

func (self Instance) CreateCodeRegion()

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

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 SetCodeRegionTags).

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 (Instance) DeleteLines

func (self Instance) DeleteLines()

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

func (Instance) DelimiterComments

func (self Instance) DelimiterComments() []string

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

func (Instance) DelimiterStrings

func (self Instance) DelimiterStrings() []string

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

func (Instance) DoIndent

func (self Instance) DoIndent()

If there is no selection, indentation is inserted at the caret. Otherwise, the selected lines are indented like IndentLines. Equivalent to the ProjectSettings "input/ui_text_indent" action. The indentation characters used depend on IndentUseSpaces and IndentSize.

func (Instance) DuplicateLines

func (self Instance) DuplicateLines()

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 (Instance) DuplicateSelection

func (self Instance) DuplicateSelection()

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

func (Instance) FoldAllLines

func (self Instance) FoldAllLines()

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

func (Instance) FoldLine

func (self Instance) FoldLine(line int)

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

func (Instance) GetAutoBraceCompletionCloseKey

func (self Instance) GetAutoBraceCompletionCloseKey(open_key string) string

Gets the matching auto brace close key for 'open_key'.

func (Instance) GetBookmarkedLines

func (self Instance) GetBookmarkedLines() []int32

Gets all bookmarked lines.

func (Instance) GetBreakpointedLines

func (self Instance) GetBreakpointedLines() []int32

Gets all breakpointed lines.

func (Instance) GetCodeCompletionOption

func (self Instance) GetCodeCompletionOption(index int) CompletionInfo

Gets the completion option at 'index'. The return data structure 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 (Instance) GetCodeCompletionOptions

func (self Instance) GetCodeCompletionOptions() []CompletionInfo

Gets all completion options, see GetCodeCompletionOption for return content.

func (Instance) GetCodeCompletionSelectedIndex

func (self Instance) GetCodeCompletionSelectedIndex() int

Gets the index of the current selected completion option.

func (Instance) GetCodeRegionEndTag

func (self Instance) GetCodeRegionEndTag() string

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

func (Instance) GetCodeRegionStartTag

func (self Instance) GetCodeRegionStartTag() string

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

func (Instance) GetDelimiterEndKey

func (self Instance) GetDelimiterEndKey(delimiter_index int) string

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

func (Instance) GetDelimiterEndPosition

func (self Instance) GetDelimiterEndPosition(line int, column int) Vector2.XY

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.XY values will be -1.

func (Instance) GetDelimiterStartKey

func (self Instance) GetDelimiterStartKey(delimiter_index int) string

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

func (Instance) GetDelimiterStartPosition

func (self Instance) GetDelimiterStartPosition(line int, column int) Vector2.XY

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.XY values will be -1.

func (Instance) GetExecutingLines

func (self Instance) GetExecutingLines() []int32

Gets all executing lines.

func (Instance) GetFoldedLines

func (self Instance) GetFoldedLines() []int

Returns all lines that are currently folded.

func (Instance) GetTextForCodeCompletion

func (self Instance) GetTextForCodeCompletion() string

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

func (Instance) GetTextForSymbolLookup

func (self Instance) GetTextForSymbolLookup() string

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

func (Instance) GetTextWithCursorChar

func (self Instance) GetTextWithCursorChar(line int, column int) string

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

func (Instance) GuttersDrawBookmarks

func (self Instance) GuttersDrawBookmarks() bool

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

func (Instance) GuttersDrawBreakpointsGutter

func (self Instance) GuttersDrawBreakpointsGutter() bool

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 SetLineAsBreakpoint.

func (Instance) GuttersDrawExecutingLines

func (self Instance) GuttersDrawExecutingLines() bool

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

func (Instance) GuttersDrawFoldGutter

func (self Instance) GuttersDrawFoldGutter() bool

If true, the fold gutter is drawn. In this gutter, the theme's 'can_fold_code_region' icon is drawn for each foldable line (see CanFoldLine) and the theme's 'folded_code_region' icon is drawn for each folded line (see IsLineFolded). These icons can be clicked to toggle the fold state, see ToggleFoldableLine. LineFolding must be true to show icons.

func (Instance) GuttersDrawLineNumbers

func (self Instance) GuttersDrawLineNumbers() bool

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.

func (Instance) GuttersZeroPadLineNumbers

func (self Instance) GuttersZeroPadLineNumbers() bool

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

func (Instance) HasAutoBraceCompletionCloseKey

func (self Instance) HasAutoBraceCompletionCloseKey(close_key string) bool

Returns true if close key 'close_key' exists.

func (Instance) HasAutoBraceCompletionOpenKey

func (self Instance) HasAutoBraceCompletionOpenKey(open_key string) bool

Returns true if open key 'open_key' exists.

func (Instance) HasCommentDelimiter

func (self Instance) HasCommentDelimiter(start_key string) bool

Returns true if comment 'start_key' exists.

func (Instance) HasStringDelimiter

func (self Instance) HasStringDelimiter(start_key string) bool

Returns true if string 'start_key' exists.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) IndentAutomatic

func (self Instance) IndentAutomatic() bool

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

func (Instance) IndentAutomaticPrefixes

func (self Instance) IndentAutomaticPrefixes() []string

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

func (Instance) IndentLines

func (self Instance) IndentLines()

Indents all lines that are selected or have a caret on them. Uses spaces or a tab depending on IndentUseSpaces. See UnindentLines.

func (Instance) IndentSize

func (self Instance) IndentSize() int

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

func (Instance) IndentUseSpaces

func (self Instance) IndentUseSpaces() bool

Use spaces instead of tabs for indentation.

func (Instance) IsInComment

func (self Instance) IsInComment(line int) 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 (Instance) IsInString

func (self Instance) IsInString(line int) 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 (Instance) IsLineBookmarked

func (self Instance) IsLineBookmarked(line int) bool

Returns true if the given line is bookmarked. See SetLineAsBookmarked.

func (Instance) IsLineBreakpointed

func (self Instance) IsLineBreakpointed(line int) bool

Returns true if the given line is breakpointed. See SetLineAsBreakpoint.

func (Instance) IsLineCodeRegionEnd

func (self Instance) IsLineCodeRegionEnd(line int) bool

Returns true if the given line is a code region end. See SetCodeRegionTags.

func (Instance) IsLineCodeRegionStart

func (self Instance) IsLineCodeRegionStart(line int) bool

Returns true if the given line is a code region start. See SetCodeRegionTags.

func (Instance) IsLineExecuting

func (self Instance) IsLineExecuting(line int) bool

Returns true if the given line is marked as executing. See SetLineAsExecuting.

func (Instance) IsLineFolded

func (self Instance) IsLineFolded(line int) bool

Returns true if the given line is folded. See FoldLine.

func (Instance) LineFolding

func (self Instance) LineFolding() bool

If true, lines can be folded. Otherwise, line folding methods like FoldLine will not work and CanFoldLine will always return false. See GuttersDrawFoldGutter.

func (Instance) LineLengthGuidelines

func (self Instance) LineLengthGuidelines() []int

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

func (Instance) MoreArgs

func (self Instance) MoreArgs() MoreArgs

MoreArgs enables certain functions to be called with additional 'optional' arguments.

func (Instance) MoveLinesDown

func (self Instance) MoveLinesDown()

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

func (Instance) MoveLinesUp

func (self Instance) MoveLinesUp()

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

func (Instance) OnBreakpointToggled

func (self Instance) OnBreakpointToggled(cb func(line int), flags ...Signal.Flags)

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.

func (Instance) OnCodeCompletionRequested

func (self Instance) OnCodeCompletionRequested(cb func(), flags ...Signal.Flags)

Emitted when the user requests code completion. This signal will not be sent if RequestCodeCompletion is overridden or CodeCompletionEnabled is false.

func (Instance) OnSymbolHovered

func (self Instance) OnSymbolHovered(cb func(symbol string, line int, column int), flags ...Signal.Flags)

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

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

func (Instance) OnSymbolLookup

func (self Instance) OnSymbolLookup(cb func(symbol string, line int, column int), flags ...Signal.Flags)

Emitted when the user has clicked on a valid symbol.

func (Instance) OnSymbolValidate

func (self Instance) OnSymbolValidate(cb func(symbol string), flags ...Signal.Flags)

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

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

func (Instance) RemoveCommentDelimiter

func (self Instance) RemoveCommentDelimiter(start_key string)

Removes the comment delimiter with 'start_key'.

func (Instance) RemoveStringDelimiter

func (self Instance) RemoveStringDelimiter(start_key string)

Removes the string delimiter with 'start_key'.

func (Instance) RequestCodeCompletion

func (self Instance) RequestCodeCompletion()

Emits OnCodeCompletionRequested, 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 (Instance) SetAutoBraceCompletionEnabled

func (self Instance) SetAutoBraceCompletionEnabled(value bool)

SetAutoBraceCompletionEnabled sets the property returned by [IsAutoBraceCompletionEnabled].

func (Instance) SetAutoBraceCompletionHighlightMatching

func (self Instance) SetAutoBraceCompletionHighlightMatching(value bool)

SetAutoBraceCompletionHighlightMatching sets the property returned by [IsHighlightMatchingBracesEnabled].

func (Instance) SetAutoBraceCompletionPairs

func (self Instance) SetAutoBraceCompletionPairs(value map[any]any)

SetAutoBraceCompletionPairs sets the property returned by [GetAutoBraceCompletionPairs].

func (Instance) SetCodeCompletionEnabled

func (self Instance) SetCodeCompletionEnabled(value bool)

SetCodeCompletionEnabled sets the property returned by [IsCodeCompletionEnabled].

func (Instance) SetCodeCompletionPrefixes

func (self Instance) SetCodeCompletionPrefixes(value []string)

SetCodeCompletionPrefixes sets the property returned by [GetCodeCompletionPrefixes].

func (Instance) SetCodeCompletionSelectedIndex

func (self Instance) SetCodeCompletionSelectedIndex(index int)

Sets the current selected completion option.

func (Instance) SetCodeHint

func (self Instance) SetCodeHint(code_hint string)

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

func (Instance) SetCodeHintDrawBelow

func (self Instance) SetCodeHintDrawBelow(draw_below bool)

If true, the code hint will draw below the main caret. If false, the code hint will draw above the main caret. See SetCodeHint.

func (Instance) SetCodeRegionTags

func (self Instance) SetCodeRegionTags()

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

func (Instance) SetDelimiterComments

func (self Instance) SetDelimiterComments(value []string)

SetDelimiterComments sets the property returned by [GetCommentDelimiters].

func (Instance) SetDelimiterStrings

func (self Instance) SetDelimiterStrings(value []string)

SetDelimiterStrings sets the property returned by [GetStringDelimiters].

func (Instance) SetGuttersDrawBookmarks

func (self Instance) SetGuttersDrawBookmarks(value bool)

SetGuttersDrawBookmarks sets the property returned by [IsDrawingBookmarksGutter].

func (Instance) SetGuttersDrawBreakpointsGutter

func (self Instance) SetGuttersDrawBreakpointsGutter(value bool)

SetGuttersDrawBreakpointsGutter sets the property returned by [IsDrawingBreakpointsGutter].

func (Instance) SetGuttersDrawExecutingLines

func (self Instance) SetGuttersDrawExecutingLines(value bool)

SetGuttersDrawExecutingLines sets the property returned by [IsDrawingExecutingLinesGutter].

func (Instance) SetGuttersDrawFoldGutter

func (self Instance) SetGuttersDrawFoldGutter(value bool)

SetGuttersDrawFoldGutter sets the property returned by [IsDrawingFoldGutter].

func (Instance) SetGuttersDrawLineNumbers

func (self Instance) SetGuttersDrawLineNumbers(value bool)

SetGuttersDrawLineNumbers sets the property returned by [IsDrawLineNumbersEnabled].

func (Instance) SetGuttersZeroPadLineNumbers

func (self Instance) SetGuttersZeroPadLineNumbers(value bool)

SetGuttersZeroPadLineNumbers sets the property returned by [IsLineNumbersZeroPadded].

func (Instance) SetIndentAutomatic

func (self Instance) SetIndentAutomatic(value bool)

SetIndentAutomatic sets the property returned by [IsAutoIndentEnabled].

func (Instance) SetIndentAutomaticPrefixes

func (self Instance) SetIndentAutomaticPrefixes(value []string)

SetIndentAutomaticPrefixes sets the property returned by [GetAutoIndentPrefixes].

func (Instance) SetIndentSize

func (self Instance) SetIndentSize(value int)

SetIndentSize sets the property returned by [GetIndentSize].

func (Instance) SetIndentUseSpaces

func (self Instance) SetIndentUseSpaces(value bool)

SetIndentUseSpaces sets the property returned by [IsIndentUsingSpaces].

func (Instance) SetLineAsBookmarked

func (self Instance) SetLineAsBookmarked(line int, bookmarked bool)

Sets the given line as bookmarked. If true and GuttersDrawBookmarks is true, draws the theme's 'bookmark' icon in the gutter for this line. See GetBookmarkedLines and IsLineBookmarked.

func (Instance) SetLineAsBreakpoint

func (self Instance) SetLineAsBreakpoint(line int, breakpointed bool)

Sets the given line as a breakpoint. If true and GuttersDrawBreakpointsGutter is true, draws the theme's 'breakpoint' icon in the gutter for this line. See GetBreakpointedLines and IsLineBreakpointed.

func (Instance) SetLineAsExecuting

func (self Instance) SetLineAsExecuting(line int, executing bool)

Sets the given line as executing. If true and GuttersDrawExecutingLines is true, draws the theme's 'executing_line' icon in the gutter for this line. See GetExecutingLines and IsLineExecuting.

func (Instance) SetLineFolding

func (self Instance) SetLineFolding(value bool)

SetLineFolding sets the property returned by [IsLineFoldingEnabled].

func (Instance) SetLineLengthGuidelines

func (self Instance) SetLineLengthGuidelines(value []int)

SetLineLengthGuidelines sets the property returned by [GetLineLengthGuidelines].

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetSymbolLookupOnClick

func (self Instance) SetSymbolLookupOnClick(value bool)

SetSymbolLookupOnClick sets the property returned by [IsSymbolLookupOnClickEnabled].

func (Instance) SetSymbolLookupWordAsValid

func (self Instance) SetSymbolLookupWordAsValid(valid bool)

Sets the symbol emitted by OnSymbolValidate as a valid lookup.

func (Instance) SetSymbolTooltipOnHover

func (self Instance) SetSymbolTooltipOnHover(value bool)

SetSymbolTooltipOnHover sets the property returned by [IsSymbolTooltipOnHoverEnabled].

func (Instance) SymbolLookupOnClick

func (self Instance) SymbolLookupOnClick() bool

Set when a validated word from OnSymbolValidate is clicked, the OnSymbolLookup should be emitted.

func (Instance) SymbolTooltipOnHover

func (self Instance) SymbolTooltipOnHover() bool

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

func (Instance) ToggleFoldableLine

func (self Instance) ToggleFoldableLine(line int)

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

func (Instance) ToggleFoldableLinesAtCarets

func (self Instance) ToggleFoldableLinesAtCarets()

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

func (Instance) UnfoldAllLines

func (self Instance) UnfoldAllLines()

Unfolds all lines that are folded.

func (Instance) UnfoldLine

func (self Instance) UnfoldLine(line int)

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

func (Instance) UnindentLines

func (self Instance) UnindentLines()

Unindents all lines that are selected or have a caret on them. Uses spaces or a tab depending on IndentUseSpaces. Equivalent to the ProjectSettings "input/ui_text_dedent" action. See IndentLines.

func (Instance) UpdateCodeCompletionOptions

func (self Instance) UpdateCodeCompletionOptions(force bool)

Submits all completion options added with AddCodeCompletionOption. Will try to force the autocomplete menu to popup, if 'force' is true.

Note: This will replace all current candidates.

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type Interface

type Interface interface {
	// Override this method to define how the selected entry should be inserted. If 'replace' is true, any existing text should be replaced.
	ConfirmCodeCompletion(replace bool)
	// Override this method to define what happens when the user requests code completion. If 'force' is true, any checks should be bypassed.
	RequestCodeCompletion(force bool)
	// Override this method to define what items in 'candidates' should be displayed.
	//
	// Both 'candidates' and the return is an slice of data structure, see [GetCodeCompletionOption] for data structure content.
	//
	// [GetCodeCompletionOption]: https://pkg.go.dev/graphics.gd/classdb/CodeEdit#Instance.GetCodeCompletionOption
	FilterCodeCompletionCandidates(candidates [][]CompletionInfo) [][]CompletionInfo
}

type MoreArgs

type MoreArgs [1]gdclass.CodeEdit

MoreArgs is a container for Instance functions with additional 'optional' arguments.

func (MoreArgs) AddCodeCompletionOption

func (self MoreArgs) AddCodeCompletionOption(atype CodeCompletionKind, display_text string, insert_text string, text_color Color.RGBA, icon Resource.Instance, value any, location int)

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

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

Note: This list will replace all current candidates.

func (MoreArgs) AddCommentDelimiter

func (self MoreArgs) AddCommentDelimiter(start_key string, end_key string, line_only bool)

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 (MoreArgs) AddStringDelimiter

func (self MoreArgs) AddStringDelimiter(start_key string, end_key string, line_only bool)

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 (MoreArgs) ConfirmCodeCompletion

func (self MoreArgs) ConfirmCodeCompletion(replace bool)

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

func (MoreArgs) ConvertIndent

func (self MoreArgs) ConvertIndent(from_line int, to_line int)

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

Values of -1 convert the entire text.

func (MoreArgs) IsInComment

func (self MoreArgs) IsInComment(line int, column int) 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 (MoreArgs) IsInString

func (self MoreArgs) IsInString(line int, column int) 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 (MoreArgs) RequestCodeCompletion

func (self MoreArgs) RequestCodeCompletion(force bool)

Emits OnCodeCompletionRequested, 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 (MoreArgs) SetCodeRegionTags

func (self MoreArgs) SetCodeRegionTags(start string, end string)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL