Table of Contents

Class ScriptEditor

Godot editor's script editor.

Inheritance
ScriptEditor

Remarks

Godot editor's script editor.

Note: This class shouldn't be instantiated directly. Instead, access the singleton using get_script_editor.

Methods

get_breakpoints

Returns array of breakpoints.

PackedStringArray get_breakpoints

get_current_editor

Qualifiers: const

Returns the ScriptEditorBase object that the user is currently editing.

ScriptEditorBase get_current_editor

get_current_script

Returns a Script that is currently active in editor.

Script get_current_script

get_open_script_editors

Qualifiers: const

Returns an array with all ScriptEditorBase objects which are currently open in editor.

ScriptEditorBase[] get_open_script_editors

get_open_scripts

Qualifiers: const

Returns an array with all Script objects which are currently open in editor.

Script[] get_open_scripts

goto_help(String)

Opens help for the given topic. The topic is an encoded string that controls which class, method, constant, signal, annotation, property, or theme item should be focused.

The supported topic formats include class_name:class, class_method:class:method, class_constant:class:constant, class_signal:class:signal, class_annotation:class:@annotation, class_property:class:property, and class_theme_item:class:item, where class is the class name, method is the method name, constant is the constant name, signal is the signal name, annotation is the annotation name, property is the property name, and item is the theme item.

# Shows help for the Node class.
class_name:Node
# Shows help for the global min function.
# Global objects are accessible in the `@GlobalScope` namespace, shown here.
class_method:@GlobalScope:min
# Shows help for get_viewport in the Node class.
class_method:Node:get_viewport
# Shows help for the Input constant MOUSE_BUTTON_MIDDLE.
class_constant:Input:MOUSE_BUTTON_MIDDLE
# Shows help for the BaseButton signal pressed.
class_signal:BaseButton:pressed
# Shows help for the CanvasItem property visible.
class_property:CanvasItem:visible
# Shows help for the GDScript annotation export.
# Annotations should be prefixed with the `@` symbol in the descriptor, as shown here.
class_annotation:@GDScript:@export
# Shows help for the GraphNode theme item named panel_selected.
class_theme_item:GraphNode:panel_selected

void goto_help(String topic)

Parameters

topic String

goto_line(int)

Goes to the specified line in the current script.

void goto_line(int line_number)

Parameters

line_number int

open_script_create_dialog(String, String)

Opens the script create dialog. The script will extend base_name. The file extension can be omitted from base_path. It will be added based on the selected scripting language.

void open_script_create_dialog(String base_name, String base_path)

Parameters

base_name String
base_path String

register_syntax_highlighter(EditorSyntaxHighlighter)

Registers the EditorSyntaxHighlighter to the editor, the EditorSyntaxHighlighter will be available on all open scripts.

Note: Does not apply to scripts that are already opened.

void register_syntax_highlighter(EditorSyntaxHighlighter syntax_highlighter)

Parameters

syntax_highlighter EditorSyntaxHighlighter

unregister_syntax_highlighter(EditorSyntaxHighlighter)

Unregisters the EditorSyntaxHighlighter from the editor.

Note: The EditorSyntaxHighlighter will still be applied to scripts that are already opened.

void unregister_syntax_highlighter(EditorSyntaxHighlighter syntax_highlighter)

Parameters

syntax_highlighter EditorSyntaxHighlighter

update_docs_from_script(Script)

Updates the documentation for the given script if the script's documentation is currently open.

Note: This should be called whenever the script is changed to keep the open documentation state up to date.

void update_docs_from_script(Script script)

Parameters

script Script

Events

editor_script_changed(Script)

Emitted when user changed active script. Argument is a freshly activated Script.

signal editor_script_changed(Script script)

Parameters

script Script

script_close(Script)

Emitted when editor is about to close the active script. Argument is a Script that is going to be closed.

signal script_close(Script script)

Parameters

script Script