class_scripteditor.rst 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/ScriptEditor.xml.
  6. .. _class_ScriptEditor:
  7. ScriptEditor
  8. ============
  9. **Inherits:** :ref:`PanelContainer<class_PanelContainer>` **<** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Godot editor's script editor.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Godot editor's script editor.
  15. \ **Note:** This class shouldn't be instantiated directly. Instead, access the singleton using :ref:`EditorInterface.get_script_editor<class_EditorInterface_method_get_script_editor>`.
  16. .. rst-class:: classref-reftable-group
  17. Methods
  18. -------
  19. .. table::
  20. :widths: auto
  21. +------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_breakpoints<class_ScriptEditor_method_get_breakpoints>`\ (\ ) |
  23. +------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`ScriptEditorBase<class_ScriptEditorBase>` | :ref:`get_current_editor<class_ScriptEditor_method_get_current_editor>`\ (\ ) |const| |
  25. +------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`Script<class_Script>` | :ref:`get_current_script<class_ScriptEditor_method_get_current_script>`\ (\ ) |
  27. +------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`Array<class_Array>`\[:ref:`ScriptEditorBase<class_ScriptEditorBase>`\] | :ref:`get_open_script_editors<class_ScriptEditor_method_get_open_script_editors>`\ (\ ) |const| |
  29. +------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`Array<class_Array>`\[:ref:`Script<class_Script>`\] | :ref:`get_open_scripts<class_ScriptEditor_method_get_open_scripts>`\ (\ ) |const| |
  31. +------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | |void| | :ref:`goto_help<class_ScriptEditor_method_goto_help>`\ (\ topic\: :ref:`String<class_String>`\ ) |
  33. +------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | |void| | :ref:`goto_line<class_ScriptEditor_method_goto_line>`\ (\ line_number\: :ref:`int<class_int>`\ ) |
  35. +------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | |void| | :ref:`open_script_create_dialog<class_ScriptEditor_method_open_script_create_dialog>`\ (\ base_name\: :ref:`String<class_String>`, base_path\: :ref:`String<class_String>`\ ) |
  37. +------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | |void| | :ref:`register_syntax_highlighter<class_ScriptEditor_method_register_syntax_highlighter>`\ (\ syntax_highlighter\: :ref:`EditorSyntaxHighlighter<class_EditorSyntaxHighlighter>`\ ) |
  39. +------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | |void| | :ref:`unregister_syntax_highlighter<class_ScriptEditor_method_unregister_syntax_highlighter>`\ (\ syntax_highlighter\: :ref:`EditorSyntaxHighlighter<class_EditorSyntaxHighlighter>`\ ) |
  41. +------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | |void| | :ref:`update_docs_from_script<class_ScriptEditor_method_update_docs_from_script>`\ (\ script\: :ref:`Script<class_Script>`\ ) |
  43. +------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. .. rst-class:: classref-section-separator
  45. ----
  46. .. rst-class:: classref-descriptions-group
  47. Signals
  48. -------
  49. .. _class_ScriptEditor_signal_editor_script_changed:
  50. .. rst-class:: classref-signal
  51. **editor_script_changed**\ (\ script\: :ref:`Script<class_Script>`\ ) :ref:`🔗<class_ScriptEditor_signal_editor_script_changed>`
  52. Emitted when user changed active script. Argument is a freshly activated :ref:`Script<class_Script>`.
  53. .. rst-class:: classref-item-separator
  54. ----
  55. .. _class_ScriptEditor_signal_script_close:
  56. .. rst-class:: classref-signal
  57. **script_close**\ (\ script\: :ref:`Script<class_Script>`\ ) :ref:`🔗<class_ScriptEditor_signal_script_close>`
  58. Emitted when editor is about to close the active script. Argument is a :ref:`Script<class_Script>` that is going to be closed.
  59. .. rst-class:: classref-section-separator
  60. ----
  61. .. rst-class:: classref-descriptions-group
  62. Method Descriptions
  63. -------------------
  64. .. _class_ScriptEditor_method_get_breakpoints:
  65. .. rst-class:: classref-method
  66. :ref:`PackedStringArray<class_PackedStringArray>` **get_breakpoints**\ (\ ) :ref:`🔗<class_ScriptEditor_method_get_breakpoints>`
  67. Returns array of breakpoints.
  68. .. rst-class:: classref-item-separator
  69. ----
  70. .. _class_ScriptEditor_method_get_current_editor:
  71. .. rst-class:: classref-method
  72. :ref:`ScriptEditorBase<class_ScriptEditorBase>` **get_current_editor**\ (\ ) |const| :ref:`🔗<class_ScriptEditor_method_get_current_editor>`
  73. Returns the :ref:`ScriptEditorBase<class_ScriptEditorBase>` object that the user is currently editing.
  74. .. rst-class:: classref-item-separator
  75. ----
  76. .. _class_ScriptEditor_method_get_current_script:
  77. .. rst-class:: classref-method
  78. :ref:`Script<class_Script>` **get_current_script**\ (\ ) :ref:`🔗<class_ScriptEditor_method_get_current_script>`
  79. Returns a :ref:`Script<class_Script>` that is currently active in editor.
  80. .. rst-class:: classref-item-separator
  81. ----
  82. .. _class_ScriptEditor_method_get_open_script_editors:
  83. .. rst-class:: classref-method
  84. :ref:`Array<class_Array>`\[:ref:`ScriptEditorBase<class_ScriptEditorBase>`\] **get_open_script_editors**\ (\ ) |const| :ref:`🔗<class_ScriptEditor_method_get_open_script_editors>`
  85. Returns an array with all :ref:`ScriptEditorBase<class_ScriptEditorBase>` objects which are currently open in editor.
  86. .. rst-class:: classref-item-separator
  87. ----
  88. .. _class_ScriptEditor_method_get_open_scripts:
  89. .. rst-class:: classref-method
  90. :ref:`Array<class_Array>`\[:ref:`Script<class_Script>`\] **get_open_scripts**\ (\ ) |const| :ref:`🔗<class_ScriptEditor_method_get_open_scripts>`
  91. Returns an array with all :ref:`Script<class_Script>` objects which are currently open in editor.
  92. .. rst-class:: classref-item-separator
  93. ----
  94. .. _class_ScriptEditor_method_goto_help:
  95. .. rst-class:: classref-method
  96. |void| **goto_help**\ (\ topic\: :ref:`String<class_String>`\ ) :ref:`🔗<class_ScriptEditor_method_goto_help>`
  97. 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.
  98. 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.
  99. ::
  100. # Shows help for the Node class.
  101. class_name:Node
  102. # Shows help for the global min function.
  103. # Global objects are accessible in the `@GlobalScope` namespace, shown here.
  104. class_method:@GlobalScope:min
  105. # Shows help for get_viewport in the Node class.
  106. class_method:Node:get_viewport
  107. # Shows help for the Input constant MOUSE_BUTTON_MIDDLE.
  108. class_constant:Input:MOUSE_BUTTON_MIDDLE
  109. # Shows help for the BaseButton signal pressed.
  110. class_signal:BaseButton:pressed
  111. # Shows help for the CanvasItem property visible.
  112. class_property:CanvasItem:visible
  113. # Shows help for the GDScript annotation export.
  114. # Annotations should be prefixed with the `@` symbol in the descriptor, as shown here.
  115. class_annotation:@GDScript:@export
  116. # Shows help for the GraphNode theme item named panel_selected.
  117. class_theme_item:GraphNode:panel_selected
  118. .. rst-class:: classref-item-separator
  119. ----
  120. .. _class_ScriptEditor_method_goto_line:
  121. .. rst-class:: classref-method
  122. |void| **goto_line**\ (\ line_number\: :ref:`int<class_int>`\ ) :ref:`🔗<class_ScriptEditor_method_goto_line>`
  123. Goes to the specified line in the current script.
  124. .. rst-class:: classref-item-separator
  125. ----
  126. .. _class_ScriptEditor_method_open_script_create_dialog:
  127. .. rst-class:: classref-method
  128. |void| **open_script_create_dialog**\ (\ base_name\: :ref:`String<class_String>`, base_path\: :ref:`String<class_String>`\ ) :ref:`🔗<class_ScriptEditor_method_open_script_create_dialog>`
  129. 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.
  130. .. rst-class:: classref-item-separator
  131. ----
  132. .. _class_ScriptEditor_method_register_syntax_highlighter:
  133. .. rst-class:: classref-method
  134. |void| **register_syntax_highlighter**\ (\ syntax_highlighter\: :ref:`EditorSyntaxHighlighter<class_EditorSyntaxHighlighter>`\ ) :ref:`🔗<class_ScriptEditor_method_register_syntax_highlighter>`
  135. Registers the :ref:`EditorSyntaxHighlighter<class_EditorSyntaxHighlighter>` to the editor, the :ref:`EditorSyntaxHighlighter<class_EditorSyntaxHighlighter>` will be available on all open scripts.
  136. \ **Note:** Does not apply to scripts that are already opened.
  137. .. rst-class:: classref-item-separator
  138. ----
  139. .. _class_ScriptEditor_method_unregister_syntax_highlighter:
  140. .. rst-class:: classref-method
  141. |void| **unregister_syntax_highlighter**\ (\ syntax_highlighter\: :ref:`EditorSyntaxHighlighter<class_EditorSyntaxHighlighter>`\ ) :ref:`🔗<class_ScriptEditor_method_unregister_syntax_highlighter>`
  142. Unregisters the :ref:`EditorSyntaxHighlighter<class_EditorSyntaxHighlighter>` from the editor.
  143. \ **Note:** The :ref:`EditorSyntaxHighlighter<class_EditorSyntaxHighlighter>` will still be applied to scripts that are already opened.
  144. .. rst-class:: classref-item-separator
  145. ----
  146. .. _class_ScriptEditor_method_update_docs_from_script:
  147. .. rst-class:: classref-method
  148. |void| **update_docs_from_script**\ (\ script\: :ref:`Script<class_Script>`\ ) :ref:`🔗<class_ScriptEditor_method_update_docs_from_script>`
  149. Updates the documentation for the given ``script`` if the script's documentation is currently open.
  150. \ **Note:** This should be called whenever the script is changed to keep the open documentation state up to date.
  151. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  152. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  153. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  154. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  155. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  156. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  157. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  158. .. |void| replace:: :abbr:`void (No return value.)`